lib/neo4j/active_rel/persistence.rb in neo4j-9.5.2 vs lib/neo4j/active_rel/persistence.rb in neo4j-9.5.3

- old
+ new

@@ -43,19 +43,20 @@ increment_by_query! query_as(:r), attribute, by, :r end def create_model validate_node_classes! - delete_has_one_rel + validate_has_one_rel rel = _create_rel return self unless rel.respond_to?(:props) init_on_load(rel, from_node, to_node, @rel_type) true end - def delete_has_one_rel - to_node.delete_has_one_rel(self, :in, from_node.class) if to_node.persisted? - from_node.delete_has_one_rel(self, :out, to_node.class) if from_node.persisted? + def validate_has_one_rel + return unless Neo4j::Config[:enforce_has_one] + to_node.validate_reverse_has_one_active_rel(self, :in, from_node) if to_node.persisted? + from_node.validate_reverse_has_one_active_rel(self, :out, to_node) if from_node.persisted? end def query_as(var) # This should query based on the nodes, not the rel neo_id, I think # Also, picky point: Should the var be `n`?