public
Created

reproduces issue 3965 config.time_zone and datetime update

  • Download Gist
gistfile1.txt
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37
gem 'rails', '3.2.1'
require 'active_record'
 
# Print out what version we're running
puts "Active Record #{ActiveRecord::VERSION::STRING}"
 
ActiveRecord::Base.time_zone_aware_attributes = true
ActiveRecord::Base.default_timezone = :utc
Time.zone = 'Amsterdam'
 
# Connect to an in-memory sqlite3 database
ActiveRecord::Base.establish_connection(
:adapter => 'sqlite3',
:database => ':memory:'
)
 
# Create schema
ActiveRecord::Schema.define do
create_table :foos, :force => true do |t|
t.datetime :bar
end
end
 
# Create the a model
class Foo < ActiveRecord::Base
end
 
# reproduce bug
foo = Foo.create(:bar => "2012-02-20 10:00:00")
 
foo.bar = "2012-02-20 09:00:00"
# expected: true
puts foo.bar_changed?
 
foo.bar = "2012-02-20 10:00:00"
# expected: false
puts foo.bar_changed?

Please sign in to comment on this gist.

Something went wrong with that request. Please try again.