# Help needed with collection\_select

**URL:** <https://www.ruby-forum.com/t/help-needed-with-collection-select/132220>\
**Category:** Rails\
**Created:** [March 18, 2008, 12:34am UTC](https://www.ruby-forum.com/t/help-needed-with-collection-select/132220 "2008-03-18T00:34:43Z")\
**Posts on this page:** 2\
**Page:** 1

<div class="post-metadata">

**Author:** ![newrubygirl](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/n/e274bd/32.png) [@newrubygirl](https://www.ruby-forum.com/u/newrubygirl)\
**Post date:** [March 18, 2008, 12:34am UTC](https://www.ruby-forum.com/t/help-needed-with-collection-select/132220/1 "2008-03-18T00:34:43Z")

</div>

I’m trying to get a collection select list to work, but I’m getting this  
error: missing attribute: state\_code

The code is a select list for states.

\<%= collection\_select(:states\_code, :state, states.states\_list,  
:state\_code, :state)%\>

The above elements are as follows

1. table name (singular, full name is states\_codes)
2. full name of state
3. select list that orders the states alphabetically (model and method)
4. state abbreviation for value
5. full name of state to display

Can anyone help me figure out what I’m doing wrong?

Thanks.

---

<div class="post-metadata">

**Author:** ![newrubygirl](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/n/e274bd/32.png) [@newrubygirl](https://www.ruby-forum.com/u/newrubygirl)\
**Post date:** [March 18, 2008, 12:48am UTC](https://www.ruby-forum.com/t/help-needed-with-collection-select/132220/2 "2008-03-18T00:48:37Z")

</div>

This is solved. Collection\_select was overkill, i used a simple select.
