After upgrading from Rails 3.0x to 3.2.11 I got the following error:
There're too many years options to be built. Are you sure you haven't mistyped something? You can provide the :max_years_allowed parameter
Code:
<%= f.date_select :to,
:start_year => Time.now.year - 80,
:discard_day => true,
:include_blank => true %>
I've also tried to include a :max_years_allowed parameter without success, how do I fix this?
According to the rails docs the select_year
method in date_select
sets max_years_allowed
to 1000 if the option isn't passed in. It then looks to see if the absolute value of the ending year minus the starting year is greater than the max_years_allowed
option. Have you opened up the rails console and checked that Time.now.year - 80
isn't giving a year more than 1000 years ago? I know it sounds crazy, but it's about the only reason I could see you getting that error.
Here's the link.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With