views:

29

answers:

1

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?

A: 

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

Jeremy