From 2cc09441c2de57b024b11ba666ba1e72c2b20cfe Mon Sep 17 00:00:00 2001 From: Troy Kruthoff Date: Fri, 1 Mar 2013 09:12:30 -0800 Subject: Fix PostgreSQL TIMESTAMP WITH TIME ZONE to return ActiveSupport::Time In an AR model a timestamptz attribute would return a ruby string and AR tests did not check for any type casting. Previous tests would pass only because an assert_equal was being used on a Time.utc object, which will parse the right side of the eq to a valid Time instance for comparision. switch to test instance of Time instead of ActiveSupport::TimeWithZone --- activerecord/lib/active_record/connection_adapters/postgresql/oid.rb | 5 +---- 1 file changed, 1 insertion(+), 4 deletions(-) (limited to 'activerecord/lib/active_record/connection_adapters/postgresql') diff --git a/activerecord/lib/active_record/connection_adapters/postgresql/oid.rb b/activerecord/lib/active_record/connection_adapters/postgresql/oid.rb index e09319890a..68f2f2ca7b 100644 --- a/activerecord/lib/active_record/connection_adapters/postgresql/oid.rb +++ b/activerecord/lib/active_record/connection_adapters/postgresql/oid.rb @@ -317,10 +317,6 @@ module ActiveRecord alias_type 'macaddr', 'text' alias_type 'uuid', 'text' - # FIXME: I don't think this is correct. We should probably be returning a parsed date, - # but the tests pass with a string returned. - register_type 'timestamptz', OID::Identity.new - register_type 'money', OID::Money.new register_type 'bytea', OID::Bytea.new register_type 'bool', OID::Boolean.new @@ -329,6 +325,7 @@ module ActiveRecord alias_type 'float8', 'float4' register_type 'timestamp', OID::Timestamp.new + register_type 'timestamptz', OID::Timestamp.new register_type 'date', OID::Date.new register_type 'time', OID::Time.new -- cgit v1.2.3