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

On Dec 29, 2015, at 8:36 AM, fugee ohu [email protected] wrote:

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 B. 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

On Dec 29, 2015, at 7:27 PM, fugee ohu [email protected] wrote:

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

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

thanks, i found it here
Active Record Associations — Ruby on Rails Guides i just did
@child.parent.attribute that works ~ thanks again