Using same form for two models


Hi, this is probably easy but I can’t find any good examples of it.
I have 2 classes, Person and EmailAddress (one person has many
email_addresses). How can I create a form on which you can add one
person and multiple email addresses to the database?

I want to avoid creating two forms.

Preferably it should also do validation so that a person always has at
least one email address.

Any ideas or links to good tutorials on this anyone?


i am trying to do the same thing…

is it possible to pass 2 hashes, one for each table to update?

for example i have a form that is composed of recipe fields and i have a
file field that gets saved to my pictures table…is there a way that i
can pass the fields that make up the recipe table to my controler where
all i have to do is a ‘.save’ on a new model and the continue on to
process the image?