I have an application running on Heroku Bamboo and I need to migrate it to Cedar, but I have a problem with dates, because of my default_timezone
:
# config/application.rb
config.time_zone = "Brasilia"
config.active_record.default_timezone = :local
With this configuration AR saves the date fields using PST (which is the :local
value for Bamboo).
But it doesn't save the TZ info in the date fields, it only offsets the dates to PST, for example the values on PG are like 2015-01-26 17:20:00
with no TZ info.
After the Cedar migration and because of :local
, AR assumes that 2015-01-26 17:20:00
is in UTC, causing wrong date values.
If I set config.active_record.default_timezone = 'Pacific Time (US & Canada)'
and use my_date_field.in_time_zone
for all my date fields in the interface, it works on Cedar, but I doesn't feel right.
Any ideas on other ways to fix that?
Aucun commentaire:
Enregistrer un commentaire