insert into 2 joined tables from the same form submission

user has many addresses so i wanna put address fields in the new user registration form, i don’t know how i would do it, i’m trying to conceptualize it

user has many addresses so i wanna put address fields in the new user registration form, i don't know how i would do it, i'm trying to conceptualize it

Have a look at accepts_nested_attributes_for and the fields_for form helper. This is a really well-solved problem in Rails. If you use simple_form, there are helpers in there for this pattern as well. And as usual, Ryan Bates wrote about this (and made a great gem for it) about a million internet-years ago: https://github.com/ryanb/nested_form and http://railscasts.com/episodes/196-nested-model-form-revised

Walter

Can you tell me how to display an attribute from the parent in a view please

Can you tell me how to display an attribute from the parent in a view please

Show your work! What have you tried already?

Walter

thanks, i found it here http://guides.rubyonrails.org/association_basics.html i just did @child.parent.attribute that works ~ thanks again