Changing default date format in Rails

Kris wrote:

Kevin Olbrich wrote:
>>def dob_formatted=(value)
>>> text_field or in_place_editor the customized default does come into
>>> >>
>>> "customer_id"=>"30", "reminder_cancel_date"=>nil, "amount"=>"300.00",
>>> the nicer parts of RoR. So this is where I became stuck. I took some
>>> > >> this, I think it's time to ask the list.
>>> > > to take a format parameter. Fire up script/console and look at
>>> > >
>>> > ActiveSupport::CoreExtensions::date::Conversions::DATE_FORMATS
>>> > --josh
>>Ed Howland
>>Rails mailing list
> Be careful changing the default format. I had an issue lately where
> doing this completely hosed MySQL. Bottom line is that ActiveRecord was
> trying to insert dates into the database in the new default format,
> instead of the way MySQL was expecting to get it. It resulted in empty
> dates, but no real error.
> Twas quite a pain to track down.
> _Kevin

Did you ever figure out how to fix this? I have the same problem,
changing the default date format effects the way it is passed to mysql.
I would think that the rails team could fix this somehow no?

Posted via

Not yet. That's on the back burner for the moment. I've just been
using the default output for now and specifically changing it when

I think the fix for this is to define a default :db date format and
modify the appropriate AR code to use that format when writing to the
DB. That way you could change the default print format without
affecting the DB writes. I think I first encountered this while the
Trac was down, so I'll go submit a ticket on this (if there isn't one