Ruby on Rails Sunday, May 28, 2017



On Sunday, May 28, 2017 at 4:28:35 PM UTC-4, Chris Lerum wrote:
try <%= f.collection_select( :artist, :genre_id, Genre.all, :id, :name) %>

On Sunday, May 28, 2017 at 4:17:53 PM UTC-4, fugee ohu wrote:
I wanna add a dropdown menu to my index view for the index action of my artists_controller Trying to use collection_select but it responds undefined method `collection_select' for nil:NilClass The idea is to list artists by genre

<div class="field"> <%= f.collection_select( :artist, :genre, Genre.all, :id, :name) %> </div>


gets me the same error, the  object is plural @artists, there's no form_for @artists instead i'm using <%= form_tag(artists_path) do |f| %>

--
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/86014fc8-fffa-43a4-926a-ab8aa5ae73b5%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

No comments:

Post a Comment