Forum: Ruby on Rails Nested forms without looping through fields_for collection.

Announcement (2017-05-07): is now read-only since I unfortunately do not have the time to support and maintain the forum any more. Please see and for other Rails- und Ruby-related community platforms.
Lundie (Guest)
on 2009-04-21 20:22
(Received via mailing list)

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?

This topic is locked and can not be replied to.