I have two tables, "Items" and "Item Types". The Scaffolding for the "edit" view is not displaying item type options.
I have traced the error into the fieldTypes() method: the key for the option cluster is not matching the key output by the findAll method. >>>>>>> It seems to expect the data to have the camel cased version of the table name, where it's getting the underscored version. <<<<<<<<<< Why is this? Output from my "traced" controller's generateFieldNames() method: looking for PK id, display field name key = item_type ttm = ItemType pass: Array ( [item_type] => Array ( [id] => 2 [name] => armor [notes] => ) ) looking for PK id, display field name key = item_type ttm = ItemType pass: Array ( [item_type] => Array ( [id] => 3 [name] => container [notes] => ) ) Excerpt from modified controller's generateFieldNames() method c. line 755 <? foreach ($rec as $pass) { $ttm = $this->{$model}- >tableToModel[$fieldNames[$tabl['name']]['table']]; echo '<p>pass: <pre>', print_r($pass, 1), '</pre><br / >looking for PK ', $otherModel->primaryKey, ', display field ', $otherDisplayField, '<p>'; foreach ($pass as $key => $value) { echo '<p>key = ', $key , '<br />ttm = ', $ttm , '</p>'; if ($key == $ttm && isset($value[$otherModel->primaryKey]) && isset($value[$otherDisplayField])) { $fieldNames[$tabl['name']]['options'][$value[$otherModel- >primaryKey]] = $value[$otherDisplayField]; } } } .. ?> My Model Classes: <?php class ItemType extends AppModel { var $name = 'item_type'; var $hasMany = array( 'Item' => array( 'className' => 'Item', 'foreign_key' => 'item_type_id' ) ); } ?> <?php class Item extends AppModel { var $name = 'Item'; var $belongsTo = array( 'ItemType', 'Skill' => array( 'foreignKey' => 'skill_id', 'className' => 'Skill' ), 'Power' => array( 'foreignKey' => 'power_id', 'className' => 'Aspect' ), 'Effect' => array( 'foreignKey' => 'effect_id', 'className' => 'Effect' ) ); } ?> SQL: CREATE TABLE `items` ( `id` int(11) NOT NULL auto_increment, `name` varchar(40) collate utf8_bin NOT NULL, `item_type_id` int(11) NOT NULL, `notes` text collate utf8_bin NOT NULL, `skill_id` int(11) NOT NULL, `power_id` int(11) NOT NULL, `effect_id` int(11) NOT NULL, `factor` float NOT NULL, `offset` int(11) NOT NULL, `price` float NOT NULL, `weight` int(11) NOT NULL, `weight_unit` enum('lbs','tons','g','kg') collate utf8_bin default 'kg', `size` int(11) NOT NULL, `size_unit` enum('in','ft','yds','cm','m') collate utf8_bin NOT NULL, PRIMARY KEY (`id`) ) ENGINE=MyISAM DEFAULT CHARSET=utf8 COLLATE=utf8_bin AUTO_INCREMENT=1 ; CREATE TABLE `item_types` ( `id` int(11) NOT NULL auto_increment, `name` varchar(40) collate utf8_bin NOT NULL, `notes` text collate utf8_bin NOT NULL, PRIMARY KEY (`id`) ) ENGINE=MyISAM DEFAULT CHARSET=utf8 COLLATE=utf8_bin AUTO_INCREMENT=6 ; -- -- Dumping data for table `item_types` -- INSERT INTO `item_types` VALUES (1, 'weapon', ''); INSERT INTO `item_types` VALUES (2, 'armor', ''); INSERT INTO `item_types` VALUES (3, 'container', ''); INSERT INTO `item_types` VALUES (4, 'clothing', ''); INSERT INTO `item_types` VALUES (5, 'tool', ''); --~--~---------~--~----~------------~-------~--~----~ You received this message because you are subscribed to the Google Groups "Cake PHP" group. To post to this group, send email to cake-php@googlegroups.com To unsubscribe from this group, send email to [EMAIL PROTECTED] For more options, visit this group at http://groups.google.com/group/cake-php?hl=en -~----------~----~----~----~------~----~------~--~---