Topic: select tag using wierd order

Hi,

My select box is ordering itself in a strange order. Any ideas on how I sort it correctly?

I've put the following ruby code in my _form.rhtml

<%= select ('applicant', 'marital_status', {
    "Single" => "single",
    "Married" => "married",
    "Divorced" => "divorced",
    "Partner" => "partner",
    "Widowed" => "widowed",
    "Separated" => "separated"
    })%>

But when I browse to the page on the server it is not putting the select options in the same order. Instead, they are being spit out in html like so:

<option value="partner">Partner</option>
<option value="married">Married</option>
<option value="separated">Separated</option>
<option value="widowed">Widowed</option>
<option value="divorced">Divorced</option>
<option value="single">Single</option>

They are placed in a strange order. Any ideas on how I sort them correctly?

Re: select tag using wierd order

You lose control over order with hashes.  Try to put them in an array instead.

BrewControl.com - Brewery and Brewpub management powered by RoR

Re: select tag using wierd order

How would I do that?