Tuesday, April 7, 2009

Rails and Dates

Stick this in environment.rb after the initialize block and have dates in the format you want.

ActiveSupport::CoreExtensions::Date::Conversions::DATE_FORMATS.merge!(:default => '%d/%m/%Y')

Model.date.to_s will use the default in the DATE_FORMATS hash if present.

No comments:

Post a Comment