You must set to the view the variable called authors like so
$this->set('authors', $this->Book->Authors->find('list'));

Cake FormHelper transforms key_id in to a select and he is looking for
a variable called authors in your view to populate that select.

On Fri, Dec 3, 2010 at 11:08 AM, Hans Wiriya Tsai <hansw...@gmail.com> wrote:
> i m trying to make a relation between 2 tables: Authors that hasMany
> Books. So I created those 2 tables and one additional field author_id
> in Books table as foreign key to Authors. Next I create Author model
> that hasMany = Book and Book model that belongsTo Author. And then on
> both controller I put scaffold. Now I can add Author without problem
> via http://localhost/authors/add. Then if I browse to
> http://localhost/books/add, the form shows but the dropdown list which
> is supposed to be a list of author won't show. The list is empty. Any
> clue? I thought scaffold should create the relation automatically...
> or perhaps i miss something?
>
> Check out the new CakePHP Questions site http://cakeqs.org and help others 
> with their CakePHP related questions.
>
> You received this message because you are subscribed to the Google Groups 
> "CakePHP" group.
> To post to this group, send email to cake-php@googlegroups.com
> To unsubscribe from this group, send email to
> cake-php+unsubscr...@googlegroups.com For more options, visit this group at 
> http://groups.google.com/group/cake-php?hl=en
>



-- 
Thanks,
Bogdan Iulian Bursuc

Check out the new CakePHP Questions site http://cakeqs.org and help others with 
their CakePHP related questions.

You received this message because you are subscribed to the Google Groups 
"CakePHP" group.
To post to this group, send email to cake-php@googlegroups.com
To unsubscribe from this group, send email to
cake-php+unsubscr...@googlegroups.com For more options, visit this group at 
http://groups.google.com/group/cake-php?hl=en

Reply via email to