Rails haml选择帮助器默认值

时间:2013-07-19 22:34:49

标签: ruby-on-rails haml

in haml我有这个:

= label_tag :card_month, "Card Expiration"
= select_year nil, {start_year: Date.today.year, end_year: Date.today.year+15}, {name: nil, id: "card_year",}

我想将选择年份的默认值设置为2020.我该怎么做?

由于

1 个答案:

答案 0 :(得分:1)

我猜是

= select_year Date.new(2020), {start_year: Date.today.year, end_year: Date.today.year+15}, {name: nil, id: "card_year"}