From 0492ea6d39e48c5bdb1d15eb4afdd54b00ece091 Mon Sep 17 00:00:00 2001 From: Yves Senn Date: Thu, 10 Oct 2013 14:41:14 +0200 Subject: `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. --- .../lib/active_record/connection_adapters/postgresql/oid.rb | 8 ++++++++ 1 file changed, 8 insertions(+) (limited to 'activerecord/lib/active_record/connection_adapters/postgresql/oid.rb') 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 -- cgit v1.2.3