Save information for parent child objects

I have a user table and a user_details table.

user_details belongs_to :user #user_id foreign key in this table

user has_one :user_detail

I have two forms. First from collects details about the user:
first_name
last_name
etc…

Then the login form where the user selects a username and password
username
password

I collect and validate the user details on the first form but don’t save
them as I need to create the user.

I know there is a way to save to both tables after they pass validation.
What would be the way to do this?

Is it something like

user << user_details

user.save

Thank you for your time in advance,

Mitch

On 04 Jul 2008, at 20:48, Mitchell G. wrote:

What would be the way to do this?

Is it something like

user << user_details

user.save

Thank you for your time in advance,

Check out Railscast episodes 73,74 and 75 on complex forms and read
through validates_associated in the Rails API documentation.

Best regards

Peter De Berdt