3

Is there an easy way to have the option to not specify a date or datetime in a Rails form that uses datetime_select, date_select or time_select? By default, the fields are set at the current date/time and there's no way to not choose a date/time.

Using Rails 3.2.8

at.
  • 50,922
  • 104
  • 292
  • 461

1 Answers1

3

What you want is the include_blank option: (Nil value on datetime_select?)

f.datetime_select :attr_name, include_blank: true
MrYoshiji
  • 54,334
  • 13
  • 124
  • 117