Non-database dropdown select - works fine, but why the weird order?

I have built a select_tag dropdown to represent a group of selections
that will feed a model-query routine I’ve written.
This routine works fine but the order of the items is different than
what I programmed. My objection to this order is that I want the ‘All
=> ‘’’ to be on the top.
Here it is;

    <tr>
      <td><strong><%= "User Module" %></strong></td>
      <td>    <%= select_tag(:module, options_for_select('All' =>

‘’, ‘Evidence’ => 1, ‘Assets’ => 2, ‘Inventory’ => 3, ‘Water’ => 4,
‘Laboratory’ => 5, ‘State EPA’ => 6, ‘Administrator’ => 7), :style =>
“width:206px”, :id => :indexselect) %>

and here is the order of items as they ‘drop down’ on the form.

Laboratory
All
Administrator
Assets
Water
Evidence
Inventory
State EPA

I am grateful for any suggestions.
Kathleen

Hashes in Ruby do not keep the insertion order, you should do it like
this:

<%= select_tag :module, options_for_select( [ [‘All’,‘’], [‘Evidence’
, 1], [‘Assets’, 2], [‘Inventory’, 3], [‘Water’ , 4], [‘Laboratory’ ,
5], [‘State EPA’, 6], [‘Administrator’, 7]]), :style => “width:206px”,
:id => :indexselect %>

On Wed, Sep 24, 2008 at 10:41 AM, [email protected]
[email protected] wrote:

     <td>    <%= select_tag(:module, options_for_select('All' =>

Assets
Water
Evidence
Inventory
State EPA

I am grateful for any suggestions.
Kathleen


Maurício Linhares
http://alinhavado.wordpress.com/ (pt-br) | http://blog.codevader.com/
(en)
João Pessoa, PB, +55 83 8867-7208