lib/neo4j/active_node/unpersisted.rb in neo4j-5.1.4 vs lib/neo4j/active_node/unpersisted.rb in neo4j-5.1.5
- old
+ new
@@ -38,11 +38,13 @@
element.is_a?(Array) ? element.each { |node| association_proc.call(node) } : association_proc.call(element)
end
end
def save_and_associate_node(association_name, node, operator)
- node.save if node.changed? || !node.persisted?
- fail "Unable to defer node persistence, could not save #{node.inspect}" unless node.persisted?
+ if node.respond_to?(:changed?)
+ node.save if node.changed? || !node.persisted?
+ fail "Unable to defer node persistence, could not save #{node.inspect}" unless node.persisted?
+ end
operator == :<< ? send(association_name).send(operator, node) : send(:"#{association_name}=", node)
end
end
end
end