From 98211755bb8145d2622b46bff9246daa607dafe4 Mon Sep 17 00:00:00 2001 From: Aaron Patterson Date: Fri, 3 Feb 2012 11:23:21 -0800 Subject: hstores can be typecast --- .../lib/active_record/connection_adapters/postgresql/oid.rb | 10 ++++++++++ 1 file changed, 10 insertions(+) (limited to 'activerecord/lib') diff --git a/activerecord/lib/active_record/connection_adapters/postgresql/oid.rb b/activerecord/lib/active_record/connection_adapters/postgresql/oid.rb index cf254eae8f..3216b7709c 100644 --- a/activerecord/lib/active_record/connection_adapters/postgresql/oid.rb +++ b/activerecord/lib/active_record/connection_adapters/postgresql/oid.rb @@ -124,6 +124,14 @@ module ActiveRecord end end + class Hstore + def type_cast(value) + return if value.nil? + + ConnectionAdapters::PostgreSQLColumn.cast_hstore value + end + end + class TypeMap def initialize @mapping = {} @@ -198,6 +206,8 @@ module ActiveRecord TYPE_MAP[603] = OID::Vector.new(';', TYPE_MAP[600]) # box TYPE_MAP[604] = OID::Identity.new # polygon TYPE_MAP[718] = OID::Identity.new # circle + + TYPE_MAP[1399854] = OID::Hstore.new # hstore end end end -- cgit v1.2.3