diff options
author | Rafael Mendonça França <rafaelmfranca@gmail.com> | 2014-06-10 11:47:25 -0300 |
---|---|---|
committer | Rafael Mendonça França <rafaelmfranca@gmail.com> | 2014-06-10 11:47:25 -0300 |
commit | 4bd2a50f882065ab4113df4c5711dd1a156a465b (patch) | |
tree | 1494aae135529e4724b2f18e8bf300e9e043895a /activerecord/lib/active_record/type/serialized.rb | |
parent | d5f480c5324c02d89b23e24a92a7a4ea58de59bc (diff) | |
parent | 47f1c10c8fb7ed9f8999dda5b4a7f42e34afeec6 (diff) | |
download | rails-4bd2a50f882065ab4113df4c5711dd1a156a465b.tar.gz rails-4bd2a50f882065ab4113df4c5711dd1a156a465b.tar.bz2 rails-4bd2a50f882065ab4113df4c5711dd1a156a465b.zip |
Merge pull request #15609 from sgrif/sg-yaml-virtual-columns
Keep the types of virtual columns after yaml serialization
Diffstat (limited to 'activerecord/lib/active_record/type/serialized.rb')
-rw-r--r-- | activerecord/lib/active_record/type/serialized.rb | 11 |
1 files changed, 11 insertions, 0 deletions
diff --git a/activerecord/lib/active_record/type/serialized.rb b/activerecord/lib/active_record/type/serialized.rb index 9144028576..e6d84eadc0 100644 --- a/activerecord/lib/active_record/type/serialized.rb +++ b/activerecord/lib/active_record/type/serialized.rb @@ -36,6 +36,17 @@ module ActiveRecord ActiveRecord::Store::IndifferentHashAccessor end + def init_with(coder) + @subtype = coder['subtype'] + @coder = coder['coder'] + __setobj__(@subtype) + end + + def encode_with(coder) + coder['subtype'] = @subtype + coder['coder'] = @coder + end + private def is_default_value?(value) |