Help needed with collection_select

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?


This is solved. Collection_select was overkill, i used a simple select.