How can I deal with collections in fieldset?


#1

Hi all,

I have a very complex model which has several has_one and has_many
relationships with other models. For the has_one relations, I can use
“field_for” to create/update the model information in a single form.
But how can I deal with the has_many relations? I know that if I what
to have collections in a form, the following code will work:

<% form_tag do %>
<% for @product in @products %>
<%= text_field(“product[]”, ‘image_url’) %>

<% end %>
<%= submit_tag %>
<% end %>

But how can I do this using “fields_for”? Thanks a lot.