Ruby on Rails Sunday, February 16, 2020



On Monday, February 17, 2020 at 12:38:03 AM UTC-5, Walter Lee Davis wrote:
You may use fields_for for any object that you have declared "accepts_nested_attributes_for" in your form's parent model. It obviously makes the most sense to do this with a related object.

Walter

> On Feb 16, 2020, at 10:41 PM, fugee ohu <fuge...@gmail.com> wrote:
>
> Can I use fields_for for any models or do they have to be associated?
>
> --
> 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 rubyonra...@googlegroups.com.
> To view this discussion on the web visit https://groups.google.com/d/msgid/rubyonrails-talk/09881329-3137-4c90-94a1-6495bccc90bd%40googlegroups.com.

In my app users have many artists, artists have many tourdates, artists have many venues, users have many venues through artists, tour_dates when added have to provide a venue so they can select from clubs or festivals that are included in the app, and they can also create a user defined venue, or select from previous user defined venues I had this working before I started concerning myself with associations by prepending all the venue fields with venue so state and city become venue_state and venue_city and I add an attribute_accessor to the tour_dates model for each venue field I feel like that still the way to do it, as long as the user defined venues belong to the artist and user so if the user ever deletes the artist the venue will be deleted also

--
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 view this discussion on the web visit https://groups.google.com/d/msgid/rubyonrails-talk/f2ba1d66-8420-41e9-b228-2456080f0ffb%40googlegroups.com.

No comments:

Post a Comment