Answer the question
In order to leave comments, you need to log in
How to save time in a model with type Time given the time zone?
There is a field in the model that is of type datetime. The user selects the time. And always either +3 hours or -3 hours. I tried to set the time in before_create to this field in_time_zone('Moscow'), in application.rb I tried to write config.active_record.default_timezone = 'Moscow' or 'UTC'; config.time_zone = 'Moscow' or 'UTC' . And in general, I erased everything in application.rb related to time. But I can't set the right time.
Thanks to all.
Answer the question
In order to leave comments, you need to log in
iKapex
Take off your shorts and run :)
Yes. really. I indulged in the console, I saw this behavior.
This happens because:
This behavior is fixed quite simply.
# config/application.rb
..........
config.active_record.time_zone_aware_attributes = false
#config/application.rb
config.active_record.default_timezone = :local
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question