diff options
author | Aaron Patterson <aaron.patterson@gmail.com> | 2012-02-03 11:23:21 -0800 |
---|---|---|
committer | Aaron Patterson <aaron.patterson@gmail.com> | 2012-02-07 14:13:46 -0800 |
commit | 98211755bb8145d2622b46bff9246daa607dafe4 (patch) | |
tree | e60ea79ad4b2a855161f4fea8116e097aedaded5 /activerecord/lib/active_record/connection_adapters | |
parent | a92af3fbf0c941c5e8c210e9bbba6a9ab50ca772 (diff) | |
download | rails-98211755bb8145d2622b46bff9246daa607dafe4.tar.gz rails-98211755bb8145d2622b46bff9246daa607dafe4.tar.bz2 rails-98211755bb8145d2622b46bff9246daa607dafe4.zip |
hstores can be typecast
Diffstat (limited to 'activerecord/lib/active_record/connection_adapters')
-rw-r--r-- | activerecord/lib/active_record/connection_adapters/postgresql/oid.rb | 10 |
1 files changed, 10 insertions, 0 deletions
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 |