lib/hanami/model/associations/has_many.rb in hanami-model-1.1.0.rc1 vs lib/hanami/model/associations/has_many.rb in hanami-model-1.1.0
- old
+ new
@@ -48,20 +48,20 @@
# @since 0.7.0
# @api private
def create(data)
entity.new(command(:create, aggregate(target), use: [:timestamps])
- .call(data))
+ .call(serialize(data)))
rescue => e
raise Hanami::Model::Error.for(e)
end
# @since 0.7.0
# @api private
def add(data)
command(:create, relation(target), use: [:timestamps])
- .call(associate(data))
+ .call(associate(serialize(data)))
rescue => e
raise Hanami::Model::Error.for(e)
end
# @since 0.7.0
@@ -199,9 +199,13 @@
# @since 0.7.0
# @api private
def __new__(new_scope)
self.class.new(repository, source, target, subject, new_scope)
+ end
+
+ def serialize(data)
+ Utils::Hash.deep_serialize(data)
end
end
end
end
end