collection_select

8 views
Skip to first unread message

fugee ohu

unread,
May 30, 2017, 10:57:37 PM5/30/17
to Ruby on Rails: Talk
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

Walter Lee Davis

unread,
May 31, 2017, 8:10:44 AM5/31/17
to rubyonra...@googlegroups.com
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 <fuge...@gmail.com> 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 rubyonrails-ta...@googlegroups.com.
> To post to this group, send email to rubyonra...@googlegroups.com.
> 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 all
Reply to author
Forward
0 new messages