Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

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?

like image 361
timpone Avatar asked Aug 15 '12 19:08

timpone


People also ask

What is form tag in Ruby on Rails?

The form_tag Rails helper generates a form withe the POST method by default, and it automatically renders the HTML that we were writing by hand before. Note: We can explicitly specify what HTTP verb to use for the form_tag if we want something other than POST .

What is local true in Rails form?

This setting determines whether form_with generates remote forms or not. It defaults to true. Or maybe more commonly set in config/application.


1 Answers

Try passing :minute_step => 15

<%= f.datetime_select :start_datetime, :ampm => true, :minute_step => 15 %>
like image 92
Raef Akehurst Avatar answered Oct 04 '22 10:10

Raef Akehurst