Answer the question
In order to leave comments, you need to log in
Why is there a shift of 3 hours if I set created_at manually?
2.2.0 :001 > toster = Toster.new
=> #<Toster id: nil, question: nil, created_at: nil, updated_at: nil>
2.2.0 :002 > toster.created_at = Time.new(2015,10,31)
=> 2015-10-31 00:00:00 +0300
2.2.0 :003 > toster
=> #<Toster id: nil, question: nil, created_at: "2015-10-30 21:00:00", updated_at: nil>
2.2.0 :004 >
# config/application.rb
config.time_zone = 'Europe/Moscow'
config.active_record.default_timezone = :local
Answer the question
In order to leave comments, you need to log in
EMNIP without specifying the time zone, it is taken from the system settings. Apparently Toster converts the time to GMT.
Looks like this is a bug:
Demonstration of the bug is the same as the OP's problem: wrong time in created_at
Same bug with developers' comment that it won't be fixed.
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question