Kristis Kristis - 3 months ago 61
Ruby Question

ruby on rails year select issue

my code looks like this

<div class="field form-group">
<%= f.label :date_of_birth %><br />
<%= date_select :date_of_birth, {order: [:month, :day, :year],
prompt: { day: 'Select day', month: 'Select month', year: 'Select year' },
start_year:1950, end_year:}, {required: true}, class: "form-control" %>

And result is in this photo

What i want that year selection be from 1950 to now.

Thanks for help!


The following code works perfectly for me:

<%= f.date_select( :date_of_birth, { :order => [:month, :day, :year], :start_year => 1950, :end_year => }, { :required => true, :class => "form-control" }) %>

Note that my date_select control is prepended with f, for the form it belongs to... I think that might be your problem.