# Nested forms without looping through fields\_for collection.

**URL:** <https://discuss.rubyonrails.org/t/nested-forms-without-looping-through-fields-for-collection/41781>\
**Category:** rubyonrails-talk\
**Created:** [April 21, 2009, 4:21pm UTC](https://discuss.rubyonrails.org/t/nested-forms-without-looping-through-fields-for-collection/41781 "2009-04-21T16:21:12Z")\
**Posts on this page:** 1\
**Page:** 1

<div class="post-metadata">

**Author:** ![Lundie](https://avatars.discourse-cdn.com/v4/letter/l/ac8455/32.png) [@Lundie](https://discuss.rubyonrails.org/u/Lundie)\
**Post date:** [April 21, 2009, 4:21pm UTC](https://discuss.rubyonrails.org/t/nested-forms-without-looping-through-fields-for-collection/41781/1 "2009-04-21T16:21:12Z")

</div>

Hi,

I have a fairly complex form and I am wondering if it is even possible to do what I am attempting.

I have multiple models included in the form. A small example would be the following:

Company has many Locations Company has many PhoneNumbers... and so on

I have this working without issue using Rails 2.3 and nested forms.

Where this becomes complex is that I also have another model named Rankings. I allow my users to assign a raking to each of the fields that are entered. Each model has a has many :through relationship with Rankings. I wish to send these fields back to the server in a nested format with the attribute that they belong to, as well as with the field name that they are being assigned to. I have attempted to use a fields\_for, but it simply loops through the entire set of Rankings duplicating each of the attributes multiple times.

Does anyone have a suggestion to implement this?

Thanks!
