How nice of rails to make it easy to change the default date format that is used when
showing a date from the database.
ActiveSupport::CoreExtensions::Date::Conversions::DATE_FORMATS.merge!( :default => "%d-%m-%Y" )
Very easy. Simple writing:
model.date.to_s
outputs the date in my format.
All seems to work well, but a few days later. TODAY!! I found out my application wasn't saving dates anymore.
The cause:
Rails uses the ":default" date definition to format the date when it builds an SQL statement. Well my MySQL version doesn't seem to understand this date format.
For now I stay away from the :default date formatter.
I've changed my custom date_picker field so now it first formats the date with the date format before showing..
Btw. I found a possible solution and a remark that this has been solved for future rails version. You can find this info at, the rails date kit.