Hi, I have a form_for to create a new object in a model.
Which form can put a date into it?
Something like this:
<%= form_for(User.new) do |f| %>
<%= f.text_field :first_name, “Name” %>
et.c.
<%= #Here is date form %>
<% end %>
Hi, I have a form_for to create a new object in a model.
Which form can put a date into it?
Something like this:
<%= form_for(User.new) do |f| %>
<%= f.text_field :first_name, “Name” %>
et.c.
<%= #Here is date form %>
<% end %>
Your answer is:
date_select
Returns a set of select tags (one for year, month, and day) pre-selected
for accessing a specified date-based attribute (identified by method) on
an object assigned to the template (identified by object).
http://api.rubyonrails.org/classes/ActionView/Helpers/DateHelper.html#method-i-date_select
Thanks!
This forum is not affiliated to the Ruby language, Ruby on Rails framework, nor any Ruby applications discussed here.
Sponsor our Newsletter | Privacy Policy | Terms of Service | Remote Ruby Jobs