1

I have a model Person and a model Option. Option belongs_to person, and Person has_many options. In the form for creating a new Person I want to be able to add several Options before you save the Person. What is the best way to do this?

3 Answers 3

1

Go for rails casts episode 196 and 197 . they have detailed explation and are the best to implement this kind of functionality

http://railscasts.com/episodes/196-nested-model-form-part-1
http://railscasts.com/episodes/197-nested-model-form-part-2
Sign up to request clarification or add additional context in comments.

Comments

0

It isn't necessarily the best solution, but Ryan Bates' nested_form library makes managing dynamic form elements for associated models quite easy. Easy to install and the usage directions in the README sound like they cover your basic case.

Comments

0

You might find my question, which was answered, and for which I post more or less complete solution files for, to be of use with nested associations:

Why submitting to wrong action when implementing "favorites", modeled after Michael Hartl's following / followers in Rails Tutorial

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.