lib/hashie_model/base.rb in hashie-model-1.3.0 vs lib/hashie_model/base.rb in hashie-model-1.3.1
- old
+ new
@@ -40,9 +40,19 @@
def validates_associated(*attr_names)
validates_with HashieModel::AssociatedValidator, _merge_attributes(attr_names)
end
end
+ def init_with(coder)
+ coder.map.each do |k, v|
+ self.send(:"#{k}=", v)
+ end
+ end
+
+ def encode_with(coder)
+ coder.represent_map(coder.tag, self)
+ end
+
def attributes_before_type_cast
@attributes_before_type_cast ||= {}
end
def attributes