# Collection\_select

**URL:** <https://www.ruby-forum.com/t/collection-select/92367>\
**Category:** Rails\
**Created:** [April 18, 2007, 7:35pm UTC](https://www.ruby-forum.com/t/collection-select/92367 "2007-04-18T19:35:56Z")\
**Posts on this page:** 1\
**Page:** 1

<div class="post-metadata">

**Author:** ![jason](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/j/dc4da7/32.png) [@jason](https://www.ruby-forum.com/u/jason)\
**Post date:** [April 18, 2007, 7:35pm UTC](https://www.ruby-forum.com/t/collection-select/92367/1 "2007-04-18T19:35:56Z")

</div>

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 🆔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?
