Hi.
I''ve searched but with no avail for a solution to my problem.
Basically, I''m trying to create a collection select on a parent-child
many_to_many relationship (in this case a product has and belongs to
many categories)
currently, I''ve got as far as:
<% form_for :product, product, :url => { :action =>
''set_status'', :id
=> product } do |f| %>
...
<% 0.upto(product.categories.size) do |i| %>
<% fields_for "categories[#{i}]", product.categories[i] do
|cat| %>
<%= cat.collection_select( :id, @category_select_collection, :id,
:select_option_text, {:prompt => ''Select category''}) %>
<% end %>
<% end %>
...
<% end %>
But I get the error: `@categories[0]'' is not allowed as an instance
variable name. What''s the most ''Rails'' way to handle
this?
--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups
"Ruby on Rails: Talk" group.
To post to this group, send email to
rubyonrails-talk-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org
To unsubscribe from this group, send email to
rubyonrails-talk-unsubscribe-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org
For more options, visit this group at
http://groups.google.com/group/rubyonrails-talk?hl=en
-~----------~----~----~----~------~----~------~--~---