Simple_form: Default value for date not used with :include_blank => true

Created on 2 Feb 2012  路  2Comments  路  Source: heartcombo/simple_form

Following expression doesn't work for simple_form. Expected date is still blank (it should be only blank if default value is nil)

<%= f.input :expected_date, :as => :date, :include_blank => true, :default => Date.today  %>

Have also tried to specify :value => , but didn't work as well

Most helpful comment

try selected: Date.yesterday. Works with me :-)

All 2 comments

This is how Rails works, if you set either :include_blank or prompt, the :default is not used, as you can see in the source code. You can try the same calling date_select directly.

try selected: Date.yesterday. Works with me :-)

Was this page helpful?
0 / 5 - 0 ratings