Search code examples
ruby-on-railsruby-on-rails-3datetime-select

form_for with datetime_select


I am using Rails 3.1 and first time using datetime_select. I want to specify the minute select box to have 15 minute intervals rather than 1 minute intervals:

  <%= f.datetime_select :start_datetime, :ampm => true, :start_minute => [0,15,30,45] %>

But this doesn't seem to work. The :start_datetime is what the property is called in the Event model. Is it possible that this is a reserved word that is causing problems?


Solution

  • Try passing :minute_step => 15

    <%= f.datetime_select :start_datetime, :ampm => true, :minute_step => 15 %>