在我的application.rb
文件中,我遇到了以下评论
# Set Time.zone default to the specified zone and make Active Record auto-convert to this zone.
# Run "rake -D time" for a list of tasks for finding time zone names. Default is UTC.
config.time_zone = 'Eastern Time (US & Canada)'
从上面可以看出,我已经将config.time_zone
设置为东部标准时间。然而,在数据库中创建记录时,datetime
仍然以UTC格式存储。
在上面的评论中,他们说:
...并使Active Record自动转换到此区域...
我该如何做到这一点,并在哪里进行设置?
另外,我将在Heroku上部署它,我希望设置能够跨越部署。