ruby-on-railsruby-on-rails-4datepicker

rails date_select, select year only


I have a form which allows user to select date, in the view i have it so the user only selects the year, but when the date is saved, it saves todays day and month along with it? all I want it to display is the year, which the user selects, this is my code:

<%= f.date_select :finishdate, :order => [:year] %><br>

Solution

  • you can try

    <%= f.select_year :finishdate, :order => [:year] %><br>