qichunren
qichunren

Reputation: 4475

How to disable rails timezone function?

I just want to insert data record into tables with 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?

Upvotes: 1

Views: 591

Answers (1)

Jeremy
Jeremy

Reputation: 4930

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

Upvotes: 1

Related Questions