Ruby on Rails 4 date_field doesn't seem to do

I am creating a form using Ruby on Rails 4. My model has a dob attribute, which is date in the database. My _form.html.erb has an excerpt like this:

 <div class="control-group"> <%= f.label :dob, :class => 'control-label' %> <div class="controls"> <%= f.date_field :dob %> </div> </div> 

For some reason, HTML gets rendered as an input text field. Is something wrong here?

+4
source share
1 answer

Try

<%= f.date_select :dob %>

More details here in the date fields.

+11
source

Source: https://habr.com/ru/post/1494836/


All Articles