rails/rails — Issue #3381: TZInfo::TimeOrDateTime compare fails in certain cases in 3.1.0+
Author: jconley
Created: 2011-10-20 18:45:33+00:00
State: open

To reproduce, create 2 clean rails installs for 3.0.10 and 3.1.1, open console and paste the appropriate migration below:

# rails 3.1.1
class Foos < ActiveRecord::Migration
def up
create_table :foos do |t|
t.timestamps
end
end
end
Foos.new.up

# rails 3.0.10
class Foos < ActiveRecord::Migration
def self.up
create_table :foos do |t|
t.timestamps
end
end
end
Foos.up

# paste these two lines
class Foo < ActiveRecord::Base; end
TZInfo::Timezone.get('America/Chicago').local_to_utc Foo.new(:created_at => DateTime.parse('2012-02-10T16:55:00+00:00')).created_at

# results
rails 3.0.10 returns "Fri, 10 Feb 2012 22:55:00 UTC +00:00" correctly

rails 3.1.1 fails with: ArgumentError: comparison of TZInfo::TimeOrDateTime with TZInfo::TimeOrDateTime failed