Just a quick and simple hint!
If you need to set the default formatting of dates throughout your whole application in Ruby on Rails, just add the following line to your "<your application>/config/environment.rb"
my_date_formats = { :default => '%d/%m/%Y' }
ActiveSupport::CoreExtensions::Time::Conversions::DATE_FORMATS.merge!(my_date_formats)
ActiveSupport::CoreExtensions::Date::Conversions::DATE_FORMATS.merge!(my_date_formats)
Note 1: Rails uses this :default format when attempting to write dates do the database, so be sure that your DBMS is able to use this new format
Note 2: you will need to restart your server so the changes will be effective.Find this article also on Define Null.
No comments:
Post a Comment