0

我有以下select()表单辅助方法:

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

帮助者看似随机地组织选择......我希望它保持选择的顺序,因为我在上面列出了它们。

我怎样才能做到这一点?

这是上面代码的输出:

<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>
4

1 回答 1

1

而不是哈希,去一个数组

<%= select("treatment", "frequency_unit", %w{hour day week month year})%>
于 2010-07-21T21:43:49.757 回答