Created
February 20, 2012 09:49
-
-
Save StefanH/1868608 to your computer and use it in GitHub Desktop.
reproduces issue 3965 config.time_zone and datetime update
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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? |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment