aboutsummaryrefslogtreecommitdiffstats
path: root/activerecord/lib/active_record/connection_adapters/postgresql/oid.rb
diff options
context:
space:
mode:
authorYves Senn <yves.senn@gmail.com>2013-10-10 14:41:14 +0200
committerYves Senn <yves.senn@gmail.com>2013-10-25 08:35:35 +0200
commit0492ea6d39e48c5bdb1d15eb4afdd54b00ece091 (patch)
tree06677dc32ad6034e837bf22f26a1ec1642290ca6 /activerecord/lib/active_record/connection_adapters/postgresql/oid.rb
parentbf43b4c33fe323448a714854327fdabdcb3c7a14 (diff)
downloadrails-0492ea6d39e48c5bdb1d15eb4afdd54b00ece091.tar.gz
rails-0492ea6d39e48c5bdb1d15eb4afdd54b00ece091.tar.bz2
rails-0492ea6d39e48c5bdb1d15eb4afdd54b00ece091.zip
`ActiveRecord::Store` works together with PG `hstore` columns.
This is necessary because as of 5ac2341 `hstore` columns are always stored as `Hash` with `String` keys. `ActiveRecord::Store` expected the attribute to be an instance of `HashWithIndifferentAccess`, which led to the bug.
Diffstat (limited to 'activerecord/lib/active_record/connection_adapters/postgresql/oid.rb')
-rw-r--r--activerecord/lib/active_record/connection_adapters/postgresql/oid.rb8
1 files changed, 8 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 dab876af14..4babee07b4 100644
--- a/activerecord/lib/active_record/connection_adapters/postgresql/oid.rb
+++ b/activerecord/lib/active_record/connection_adapters/postgresql/oid.rb
@@ -234,6 +234,10 @@ module ActiveRecord
ConnectionAdapters::PostgreSQLColumn.string_to_hstore value
end
+
+ def accessor
+ ActiveRecord::Store::StringKeyedHashAccessor
+ end
end
class Cidr < Type
@@ -250,6 +254,10 @@ module ActiveRecord
ConnectionAdapters::PostgreSQLColumn.string_to_json value
end
+
+ def accessor
+ ActiveRecord::Store::StringKeyedHashAccessor
+ end
end
class TypeMap