lib/neo4j/active_node/dependent/association_methods.rb in neo4j-5.0.15 vs lib/neo4j/active_node/dependent/association_methods.rb in neo4j-5.1.0.rc.1

- old
+ new

@@ -30,14 +30,16 @@ def dependent_delete_orphans_callback(object) object.as(:self).unique_nodes(self, :self, :n, :other_rel).query.delete(:n, :other_rel).exec end def dependent_destroy_callback(object) - object.association_query_proxy(name).each_for_destruction(object, &:destroy) + unique_query = object.association_query_proxy(name) + unique_query.each_for_destruction(object, &:destroy) if unique_query end def dependent_destroy_orphans_callback(object) - object.as(:self).unique_nodes(self, :self, :n, :other_rel).each_for_destruction(object, &:destroy) + unique_query = object.as(:self).unique_nodes(self, :self, :n, :other_rel) + unique_query.each_for_destruction(object, &:destroy) if unique_query end # End callback methods end end