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: https://github.com/ryanb/nested_form and
http://railscasts.com/episodes/196-nested-model-form-revised

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
http://guides.rubyonrails.org/association_basics.html i just did
@child.parent.attribute that works ~ thanks again

This forum is not affiliated to the Ruby language, Ruby on Rails framework, nor any Ruby applications discussed here.

| Privacy Policy | Terms of Service | Remote Ruby Jobs