开发者

nil :selected value for date helper in formtastic

I'm using the following code for a date field:

    <%= f.input :date_of_birth, :selected => nil,
                            :order => [:day, :month, :year], 
                            :prompt => {:day => "Day", :month => "Month", :year => "Year"},
                            :start_year => Time.now.year - 15,
                            :end_year => Time.now.year - 100 %>

Everything works as expected, except for :selected => nil. I'm using 0.9.7, all the specs pass, including the one regarding a nil :selected value. When I use this though, the current date is selected, save for the year, which doesn't exist开发者_运维百科.

Am I missing something here? I tried with :as => :date and that did't make any difference.

Tom


This is a known regression/bug in Formtastic right now. Expect a fix in the next gem release.


You could try to add :include_blank => true, maybe that helps?

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜