Rails date_select woes

I have encountered some messy issues in using date_select in Rails. I have this Rails code in my view:

<%= date_select('task', 'due_date', :order => [:month, :day, :year],
 :include_blank => true)  %>

When the user fills in the month and day and leaves out the year, an exception is thrown (”1 error(s) on assignment of multiparameter attributes.”) It looks like ActiveRecord using the user’s month for the year (e.g. April is saved as 2004), and the user input for day is saved as the month. I was able to work around the problem by putting some extra code in the controller code - yuck, how ugly.

Found out there is a Rails patch (Ticket #8797) for this.



				
				

			
blog comments powered by Disqus