Scaffolding A model with an attribute of type datetime creates a 10 years range in the form

Posted by b_ayan on Stack Overflow See other posts from Stack Overflow or by b_ayan
Published on 2010-05-07T02:22:52Z Indexed on 2010/05/07 2:28 UTC
Read the original article Hit count: 242

Filed under:
|

For a simple rails application ( 1.86 /2.3.5) , lets say I run a simple scaffold

script/generate scaffold blog title:string content:text published:date

When I open up the new / edit view for the blog controller in index/new.html.erb , I see that the drop down enabler for date select has a date range of 2005 - 2015 , i.e 5 years +/-

I tried to change this default behavior by introducing this code

f.date_select :entered,
              :start_year => 1970,
              :end_year => 2020

Apparently this has no impact to the behavior mentioned above. How do I increase the date_select range which seems to be default?

© Stack Overflow or respective owner

Related posts about ruby-on-rails

Related posts about date