开发者

How to disable rails timezone function?

I just want to insert data record into tables with 开发者_StackOverflow社区no timezone support.How to config it?

That is to say: the current time is 2010-10-10 15:22:31 in my country/region,I want to the column created_at on the record in the table I just inserted is 2010-10-10 15:22:31.

How to config it?


Rails converts from your current timezone to the configured db timezone, I suggest you set both Time.zone = "NZST" and the db backend time to ActiveRecord::Base.default_timezone = "NZST" (replace 'NZST' with the timezone that you're in/that your server is set to). Then the timestamps should all match up.

Set both these config options in config/environments.rb

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜