On 04 Jul 2008, at 20:48, Mitchell Gould wrote:
> 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,
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
--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups
"Ruby on Rails: Talk" group.
To post to this group, send email to
rubyonrails-talk-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org
To unsubscribe from this group, send email to
rubyonrails-talk-unsubscribe-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org
For more options, visit this group at
http://groups.google.com/group/rubyonrails-talk?hl=en
-~----------~----~----~----~------~----~------~--~---