选择的年度变化范围

时间:2015-07-21 13:24:48

标签: ruby-on-rails ruby date datetime select

我有什么

options_for_select(1995..Date.today.year)

我想用蛮力的方式

options_for_select((1995..Date.today.year).to_a.reverse)

如何在不必反转数组的情况下重写第二个options_for_select

1 个答案:

答案 0 :(得分:3)

您可以改为使用downto

options_for_select(Date.today.year.downto(1995))