Ruby on Rails Tuesday, December 29, 2015

> On Dec 29, 2015, at 8:36 AM, fugee ohu <fugee279@gmail.com> 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 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

> --
> You received this message because you are subscribed to the Google Groups "Ruby on Rails: Talk" group.
> To unsubscribe from this group and stop receiving emails from it, send an email to rubyonrails-talk+unsubscribe@googlegroups.com.
> To post to this group, send email to rubyonrails-talk@googlegroups.com.
> To view this discussion on the web visit https://groups.google.com/d/msgid/rubyonrails-talk/5898a890-523e-48b2-bf2e-0d12d992c18c%40googlegroups.com.
> For more options, visit https://groups.google.com/d/optout.

--
You received this message because you are subscribed to the Google Groups "Ruby on Rails: Talk" group.
To unsubscribe from this group and stop receiving emails from it, send an email to rubyonrails-talk+unsubscribe@googlegroups.com.
To post to this group, send email to rubyonrails-talk@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/rubyonrails-talk/176C439F-A99E-40BA-8031-E97EC970DD66%40wdstudio.com.
For more options, visit https://groups.google.com/d/optout.

No comments:

Post a Comment