I have a select box that looks like this (within a form_for)
<%=f.select(:whatever_id, {'blah'=>0, 'blah2'=>1, 'blah3'=>2, 'blah4'=>3}, {:include_blank => true}) %>
and the output is good, but weird… like this:
<select id='personal_information_whatever_id' name='personal_information[whatever_id]'><option value=''></option> <option value='1'>blah2</option> <option value='2'>blah3</option> <option value='0'>blah</option> <option value='3'>blah4</option></select>
But I want it to go in order… what is happening, and how can I correct it?
Edit: I feel like the answer has to do with this
You can never be guaranteed of any order with hashes. You could try .sort() to sort the values in alphabetical order.
is there anything I can use aside from a hash?
Yes, you should use an array of arrays. The easiest way with your example would be something like this:
This should suffice. Take a look at the docs at api.rubyonrails.com too.