lib/paper_trail/serializers/yaml.rb in paper_trail-10.2.0 vs lib/paper_trail/serializers/yaml.rb in paper_trail-10.2.1
- old
+ new
@@ -10,10 +10,15 @@
def load(string)
::YAML.load string
end
+ # @param object (Hash | HashWithIndifferentAccess) - Coming from
+ # `recordable_object` `object` will be a plain `Hash`. However, due to
+ # recent [memory optimizations](https://git.io/fjeYv), when coming from
+ # `recordable_object_changes`, it will be a `HashWithIndifferentAccess`.
def dump(object)
+ object = object.to_hash if object.is_a?(HashWithIndifferentAccess)
::YAML.dump object
end
# Returns a SQL LIKE condition to be used to match the given field and
# value in the serialized object.