Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Ruby on Rails 4 date_field doesn't seem to render

I am building a form using Ruby on Rails 4. My model has a dob attribute that is a 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 whatever reason, the HTML gets rendered as a regular input text box. Is there something being done wrong here?

like image 868
randombits Avatar asked Dec 20 '22 02:12

randombits


1 Answers

Try

<%= f.date_select :dob %>

See more here on date fields.

like image 123
Jason Kim Avatar answered Feb 10 '23 10:02

Jason Kim