I recommend handling complex nested attributes like this with this gem
https://github.com/trailblazer/reform

here you can find a good documenation

http://trailblazer.to/gems/reform/api.html

On Sun, Jan 15, 2017 at 5:38 PM, Andrew Cockerham <[email protected]>
wrote:

> I know this thread is crazy old....but I'm looking for a solution to
> submit one form with multiple instances of one model. I have a Responses
> model, and a user answers many questions on a page (like a quiz), and I
> want them to submit all their responses on one form. I had it working
> similar to Ryan's approach 1, but the problem of multiple inputs with the
> same name in the HTML was causing trouble.
>
> What is the current thinking on handling this in Rails 5? This has got to
> be a relatively common thing to want to do...
>
> On Thursday, September 18, 2008 at 3:30:17 PM UTC-5, Eloy Duran wrote:
>>
>> > Agreed, the setter method should have a different name than the
>> > existing "tasks=" method. The behavior is different enough to warrant
>> > its own method. Otherwise it will just be confusing on the
>> > implementation side and the API side. Is there any good reason for
>> > using the same setter method?
>>
>> The reason I had used the association setter is because in the case
>> of  a has_one association things like fields_for would work out of
>> the box and I only needed to create a special fields_for for a
>> has_many association.
>>
>> Eloy
>>
>> --
> You received this message because you are subscribed to the Google Groups
> "Ruby on Rails: Core" group.
> To unsubscribe from this group and stop receiving emails from it, send an
> email to [email protected].
> To post to this group, send email to [email protected].
> Visit this group at https://groups.google.com/group/rubyonrails-core.
> For more options, visit https://groups.google.com/d/optout.
>

-- 
You received this message because you are subscribed to the Google Groups "Ruby 
on Rails: Core" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to [email protected].
To post to this group, send email to [email protected].
Visit this group at https://groups.google.com/group/rubyonrails-core.
For more options, visit https://groups.google.com/d/optout.

Reply via email to