setting the timezone in postgres to whatever ruby thinks the timezone is [#4895 state:resolved]

Signed-off-by: Jeremy Kemper <jeremy@bitsweat.net>
This commit is contained in:
Aaron Patterson 2010-06-17 16:39:36 -07:00 committed by Jeremy Kemper
parent 5ae7a9d31d
commit bf6661c5d7
2 changed files with 11 additions and 1 deletions

View File

@ -1,3 +1,8 @@
*Rails 3.0.0 [RC1] (unreleased)*
* PostgreSQL: ensure the database time zone matches Ruby's time zone. #4895 [Aaron Patterson]
*Rails 3.0.0 [beta 4] (June 8th, 2010)* *Rails 3.0.0 [beta 4] (June 8th, 2010)*
* Fixed that ActiveRecord::Base.compute_type would swallow NoMethodError #4751 [Andrew Bloomgarden, Andrew White] * Fixed that ActiveRecord::Base.compute_type would swallow NoMethodError #4751 [Andrew Bloomgarden, Andrew White]

View File

@ -927,7 +927,12 @@ module ActiveRecord
# If using Active Record's time zone support configure the connection to return # If using Active Record's time zone support configure the connection to return
# TIMESTAMP WITH ZONE types in UTC. # TIMESTAMP WITH ZONE types in UTC.
execute("SET time zone 'UTC'") if ActiveRecord::Base.default_timezone == :utc if ActiveRecord::Base.default_timezone == :utc
execute("SET time zone 'UTC'")
else
offset = Time.local(2000).utc_offset / 3600
execute("SET time zone '#{offset}'")
end
end end
# Returns the current ID of a table's sequence. # Returns the current ID of a table's sequence.