aboutsummaryrefslogtreecommitdiffstats
path: root/activerecord/lib/active_record/type/serialized.rb
diff options
context:
space:
mode:
Diffstat (limited to 'activerecord/lib/active_record/type/serialized.rb')
-rw-r--r--activerecord/lib/active_record/type/serialized.rb11
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)