Skip to content

@StefanH /gist:1868608
Created

Embed URL

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP
reproduces issue 3965 config.time_zone and datetime update
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
Something went wrong with that request. Please try again.