views:

42

answers:

1

I've got the following select() form helper method:

select("treatment", "frequency_unit", { "hour" => "hour", "day" => "day", "week" => "week", "month" => "month", "year" => "year" })

The helper is organizing the choices seemingly randomly...I'd like it to maintain the order of the choices as I have them listed above.

How can I make that happen?

Here's the output of the code above:

<select id="treatment_frequency_unit" name="treatment[frequency_unit]">
  <option value="month">month</option>
  <option value="week">week</option>
  <option value="hour">hour</option>
  <option value="day">day</option>
  <option value="year">year</option>
</select>
+1  A: 

Instead of the hash, go for an array

<%= select("treatment", "frequency_unit", %w{hour day week month year})%>
Jesse Wolgamott