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: GitHub - ryanb/nested_form: Rails plugin to conveniently handle multiple models in a single form. and #196 Nested Model Form (revised) - RailsCasts

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 Active Record Associations — Ruby on Rails Guides i just did @child.parent.attribute that works ~ thanks again