lib/active_graph/node/query/query_proxy.rb in activegraph-11.5.0.beta.3 vs lib/active_graph/node/query/query_proxy.rb in activegraph-12.0.0.beta.1

- old
+ new

@@ -221,11 +221,11 @@ fail 'Can only create relationships on associations' if !@association other_nodes = _nodeify!(*other_nodes) ActiveGraph::Base.transaction do other_nodes.each do |other_node| - if other_node.neo_id + if other_node.element_id other_node.try(:delete_reverse_has_one_core_rel, association) else other_node.save end @@ -236,11 +236,11 @@ end end def _nodeify!(*args) other_nodes = [args].flatten!.map! do |arg| - (arg.is_a?(Integer) || arg.is_a?(String)) ? @model.find_by(id: arg) : arg + arg.is_a?(String) ? @model.find_by(id: arg) : arg end.compact if @model && other_nodes.any? { |other_node| !other_node.class.mapped_label_names.include?(@model.mapped_label_name) } fail ArgumentError, "Node must be of the association's class when model is specified" end @@ -349,10 +349,10 @@ def _association_chain_var fail 'Crazy error' if !(start_object || @query_proxy) if start_object - :"#{start_object.class.name.gsub('::', '_').downcase}#{start_object.neo_id}" + :"#{start_object.class.name.gsub('::', '_').downcase}#{start_object.neo_id&.gsub(/[:\-]/, '_')}" else @query_proxy.node_var || :"node#{_chain_level}" end end