I need to turn off the time conversions between Rails application and Mysql.
This comment at ActiveRecord source say that:
# Timestamps are in UTC by default but you can use the local timezone by setting:
#
# config.active_record.default_timezone = :local
But, my server uses the UTC
timezone and it'll no make difference if use :local
or :utc
option. The needed timezone is 'Brasilia'
.
The Rails console on production server show the conversions:
$ RAILS_ENV=production bundle exec rails c
Loading production environment (Rails 4.1.4)
2.0.0 :001 > Time.current
=> Wed, 13 Aug 2014 17:34:15 BRT -03:00
2.0.0 :002 > Schedule.where(startDateTimeSchedule: Time.current)
Schedule Load (1.0ms) SELECT `Schedule`.* FROM `Schedule` WHERE `Schedule`.`startDateTimeSchedule` = '2014-08-13 20:34:25'
P.S.: The accepted answer of the highly voted question about this subject is wrong.