Creating a master/detail record in one shot

How would I set up the controllers so that I can insert a detail record with information from the web page and the master record at the same time?

For instance if I had a new book entry in the book database I want to add a new author record in the author database - assuming the author did not exist.

Thanks!

It's easier than you think.

In general...

# set up the master record ... # <however you do that> master = Master.find(id), etc.

# set up the detail records... <however you do THAT>

# associate the 2 master.details << detail # or, master.details = details # or, master.details << details

# profit! if master.save     success else     error end