aboutsummaryrefslogtreecommitdiffstats
path: root/activerecord/lib/active_record/type/decorator.rb
diff options
context:
space:
mode:
Diffstat (limited to 'activerecord/lib/active_record/type/decorator.rb')
-rw-r--r--activerecord/lib/active_record/type/decorator.rb14
1 files changed, 14 insertions, 0 deletions
diff --git a/activerecord/lib/active_record/type/decorator.rb b/activerecord/lib/active_record/type/decorator.rb
new file mode 100644
index 0000000000..9fce38ea44
--- /dev/null
+++ b/activerecord/lib/active_record/type/decorator.rb
@@ -0,0 +1,14 @@
+module ActiveRecord
+ module Type
+ module Decorator # :nodoc:
+ def init_with(coder)
+ @subtype = coder['subtype']
+ __setobj__(@subtype)
+ end
+
+ def encode_with(coder)
+ coder['subtype'] = __getobj__
+ end
+ end
+ end
+end