From http://svn.techno-weenie.net/projects/plugins/us_states/, updated to run under rails 2.2.
To select "priority" states that show up at the top of the list, call like so:
<%= us_state_select 'child', 'state', :priority => %w(TX CA) %>
The default...
<%= us_state_select 'child', 'state'%>
...will yield this:
<option value="AK">Alaska</option>
Or you can change it up...
<%= us_state_select 'child', 'state', :show => :full %>
...and get this.
<option value="Alaska">Alaska</option>
Options are:
- :full = Alaska
- :full_abb = Alaska
- :abbreviations = AK
- :abb_full_abb = AK - Alaska
You can also pass a proc to show:
<%= us_state_select 'child', 'state', :show => Proc.new {|state| [state.first, state.first]} %>
The array you are iterating over looks like this:
[["Alaska", "AK"], ["Alabama","AL"], ...]