# How can I deal with collections in fieldset?

**URL:** <https://www.ruby-forum.com/t/how-can-i-deal-with-collections-in-fieldset/92889>\
**Category:** Rails\
**Created:** [April 25, 2007, 12:51pm UTC](https://www.ruby-forum.com/t/how-can-i-deal-with-collections-in-fieldset/92889 "2007-04-25T12:51:36Z")\
**Posts on this page:** 1\
**Page:** 1

<div class="post-metadata">

**Author:** ![allen](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/a/bbce88/32.png) [@allen](https://www.ruby-forum.com/u/allen)\
**Post date:** [April 25, 2007, 12:51pm UTC](https://www.ruby-forum.com/t/how-can-i-deal-with-collections-in-fieldset/92889/1 "2007-04-25T12:51:36Z")

</div>

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.
