Tag: activerecord

如何更改Rails中Active Record的默认时区?

在我的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为EST时间。 但是,仍然在DB中创buildlogging时,看起来datetime是以UTC格式存储的。 他们在上面的评论中说 …并使活动logging自动转换到此区域… 我怎么能做到这一点,在哪里? 另外,我也会在heroku上部署这个,我希望这个设置继续下去