On Saturday, May 20, 2006, at 5:41 PM, olivier Hericord wrote:
will handle setting up all the foreign keys for you.
Rails mailing list
So far as I can tell, the only way to avoid the use of AJAX in a form
for an object that may associate with many other items is to force the
user to enter the associated objects before calling the form. In some
cases this may not be a problem, but in many it is. For example…
If you have a Person model that has_many PhoneNumbers, it is fairly
impractical to expect the user to enter the phone numbers before
entering the person’s information.
It is possible to set up the form to accept a fixed number of sub
objects that will be associated. Following from the previous example,
you would need to set up form fields for 10 new phone numbers, and then
hope that was enough.
One approach that may work would be to store the main object and it’s
associated objects in the session and then save the whole lot when the
form is submitted.