Forum: Ruby on Rails collection_select

Announcement (2017-05-07): is now read-only since I unfortunately do not have the time to support and maintain the forum any more. Please see and for other Rails- und Ruby-related community platforms.
Jason (Guest)
on 2007-04-18 21: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.