I hope this looks okay, preview is busted.
Original ticket here: http://dev.rubyonrails.org/ticket/7979
Summary from original:
I'm using the following date_select in a view:
date_select('project', 'start_at',
:end_year => 1980, :start_year =>Date.today.year,
:discard_day => true,
:include_blank => true,
:order => [:month, :year])
However, when selecting the blank (:include_blank) option, the
date is not typecast to NULL as it should be - rather, it is set to
2001 (for some reason).
A debug() of params[:project] reveals that the :discard_day
option causes rails to set the start_at(3i) param to "1", which
then causes the entire date to not be recognized as a nil
submission.
Original comment:
This appears to happen when start_at was set already somewhere
in the code. For instance by a default value or by assignment
triggered on the previous request. Because start_at was already
set, the helper will set the day value of start_at to 1 to make
sure that whatever month or year is chosen, it will be a valid
date. This is normally a good assumption, but not when you want to
allow blank.
When these values eventually end up in ActiveRecord the
automated type casting on multiparameter assign ends up calling
Time.local(1) to set start_at. Which happens to be Mon Jan 01
00:00:00 +0100 2001. So it interprets the day value as a year
value. This causes two problems; ActiveRecord can't do validation
on the time anymore, but it also uses the parameter for the wrong
argument.