collection_select

Previous Topic Next Topic
 
classic Classic list List threaded Threaded
2 messages Options
Reply | Threaded
Open this post in threaded view
|

collection_select

fugee ohu
I'm creating a new PressRelease  the PressRelease model has no club_id column it has columns like venue, venue_city, venue_state, etc. I wanna add a collection_select to the form to get a club_id into the params from the Club model How should my collection_select be constructed I have something like  <%= f.collection_select(:club_id, Club.all, :id, :club, prompt: true) %> but this causes an undefined method 'club_id' error

--
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 [hidden email].
To post to this group, send email to [hidden email].
To view this discussion on the web visit https://groups.google.com/d/msgid/rubyonrails-talk/7f636bca-f73d-477f-8687-ae91019a2547%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.
Reply | Threaded
Open this post in threaded view
|

Re: collection_select

Walter Lee Davis
What is the relationship between a club and a press release? Does a club have many press releases? Start with the real-world relationship, then add that relationship to your Rails models. The answer will suggest itself.

Walter

> On May 30, 2017, at 10:57 PM, fugee ohu <[hidden email]> wrote:
>
> I'm creating a new PressRelease  the PressRelease model has no club_id column it has columns like venue, venue_city, venue_state, etc. I wanna add a collection_select to the form to get a club_id into the params from the Club model How should my collection_select be constructed I have something like <%= f.collection_select(:club_id, Club.all, :id, :club, prompt: true) %> but this causes an undefined method 'club_id' error
>
>
> --
> 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 [hidden email].
> To post to this group, send email to [hidden email].
> To view this discussion on the web visit https://groups.google.com/d/msgid/rubyonrails-talk/7f636bca-f73d-477f-8687-ae91019a2547%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 [hidden email].
To post to this group, send email to [hidden email].
To view this discussion on the web visit https://groups.google.com/d/msgid/rubyonrails-talk/BE359B17-9275-4528-A8DD-5BF9E4218339%40wdstudio.com.
For more options, visit https://groups.google.com/d/optout.