List Info

Thread: HABTM and collection_select




HABTM and collection_select
user name
2006-08-17 18:50:05
Hi,

I'm trying to use collection_select with a habtm
relationship. Let's say 
you have two tables: books and authors with a many-to-many
relationship.

Is there any way in rails to render something like selection
boxes for 
each author, so that the user can change them?

I tried this (and several more variations) but it doesn't
work:

<% for author in book.authors %>
<%= collection_select("author[]",
"author_id", authors, :id, 
:full_name) %>
<% end %>

Is it possible to use collection select for this ?

Thanks in advance,

- Juancho

-- 
Posted via http://www.ruby-forum.com
/.
_______________________________________________
Rails mailing list
Railslists.rubyonrails.org
h
ttp://lists.rubyonrails.org/mailman/listinfo/rails
[1]

about | contact  Other archives ( Real Estate discussion Medical topics )