Forum: Ruby on Rails collection_select

Announcement (2017-05-07): www.ruby-forum.com is now read-only since I unfortunately do not have the time to support and maintain the forum any more. Please see rubyonrails.org/community and ruby-lang.org/en/community for other Rails- und Ruby-related community platforms.
28c7ef5ffd77ddcaf495aa389103b764?d=identicon&s=25 Jason (Guest)
on 2007-04-18 19:35
I'm trying to populate a select box with a collection.  I have the
following code in my view:

<%= collection_select(:heading, @headings, :id, :name, nil, {:onChange
=> 'submit();'}) %>

But when I run it, I get an exception and the following error:

undefined method `inject' for :id:Symbol

What's going on here?  Does collection_select have to be used inside a
form_for rather than a form_tag?

Alternatively,  is there anyway to use select_tag and have it use an
onchange javascript event?
This topic is locked and can not be replied to.