tags:

views:

31

answers:

2
A: 

So far I agree :

posts     > belongs to > users
posts     > belongs to > feednames
feednames > has many   > posts
users     > has many   > posts

Just checking, but, did you actually insert data into your tables? Else it would be only logical that your select field is empty. Also, what does the Sql dump say in debug mode?

Damien
Yes, data is in the tables. The SQL dump is empty for the posts/add.ctp view - indicating that the Feednames info for the select box was not retrieved from database. I've edited the question to include the SQL from the posts/index.ctp.
Mark Flint
+1  A: 

Do you have something like this in your controller methods (e.g. the admin_add / admin_edit functions)?

$feednames = $this->Feedname->find('list');
$this->set('feednames', $feednames);

Cake should then automatically populate the select list with these values. Or you can manually set the values with:

$form->input('feedname_id', array('options' => $feednames));
handsofaten
I have similar in my FeednamesController, but not in PostsController. I thought the model .php files relationship vars were supposed to do this work rather than the controller.
Mark Flint
If you want the data (a list of feednames) to show up in your posts view (e.g. admin_edit or admin_add), you need to find the data and send it to the view. If you use Cake Bake for your controller, it will generate something similar to what I posted above. Try it.
handsofaten
I started again, baked the models and controllers with the console, and found that I needed $feednames = $this->Post->Feedname->find('list'); in my controller. Thanks for pointing me in the right direction :)
Mark Flint
Glad I could help.. if you include Feedname in `$uses` you can write `$this->Feedname->find(...)` and directly access any Feedname methods. But yes, without that you would need `$this->Post->Feedname->find(...)`
handsofaten