diff options
author | Yves Senn <yves.senn@gmail.com> | 2013-10-10 14:41:14 +0200 |
---|---|---|
committer | Yves Senn <yves.senn@gmail.com> | 2013-10-25 08:35:35 +0200 |
commit | 0492ea6d39e48c5bdb1d15eb4afdd54b00ece091 (patch) | |
tree | 06677dc32ad6034e837bf22f26a1ec1642290ca6 /activerecord/lib/active_record/attribute_methods | |
parent | bf43b4c33fe323448a714854327fdabdcb3c7a14 (diff) | |
download | rails-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/attribute_methods')
-rw-r--r-- | activerecord/lib/active_record/attribute_methods/serialization.rb | 4 |
1 files changed, 4 insertions, 0 deletions
diff --git a/activerecord/lib/active_record/attribute_methods/serialization.rb b/activerecord/lib/active_record/attribute_methods/serialization.rb index 1287de0d0d..5701804168 100644 --- a/activerecord/lib/active_record/attribute_methods/serialization.rb +++ b/activerecord/lib/active_record/attribute_methods/serialization.rb @@ -66,6 +66,10 @@ module ActiveRecord def type @column.type end + + def accessor + ActiveRecord::Store::IndifferentHashAccessor + end end class Attribute < Struct.new(:coder, :value, :state) # :nodoc: |