您如何按降序显示年份?目前,我有这个:
<%= f.input :year_started, as: :date, label: "Date started", start_year: Date.today.year - 100, end_year: Date.today.year, discard_day: true, order: [:month, :year], include_blank: true, default: nil, :input_html => { :class => 'profile-date' } %>
下拉年份显示如下:
1900
1901
1902
....
2015
我想要相反的,你怎么做?:
2015
2014
2013
....
1900
感谢。
答案 0 :(得分:6)
我认为这就像交换start_year和end_year一样简单。
尝试:
<%= f.input :year_started, as: :date, label: "Date started", start_year: Date.today.year, end_year: Date.today.year - 100, discard_day: true, order: [:month, :year], include_blank: true, default: nil, :input_html => { :class => 'profile-date' } %>