lib/neo4j/active_rel.rb in neo4j-5.2.15 vs lib/neo4j/active_rel.rb in neo4j-6.0.0.alpha.1

- old
+ new

@@ -25,16 +25,19 @@ def inspect attribute_pairs = attributes.sort.map { |key, value| "#{key}: #{value.inspect}" } attribute_descriptions = attribute_pairs.join(', ') separator = ' ' unless attribute_descriptions.empty? - cypher_representation = "#{node_cypher_representation(:from)}-[:#{type}]->#{node_cypher_representation(:to)}" + cypher_representation = "#{node_cypher_representation(from_node)}-[:#{type}]->#{node_cypher_representation(to_node)}" "#<#{self.class.name} #{cypher_representation}#{separator}#{attribute_descriptions}>" end - def node_cypher_representation(direction) - node = send(:"#{direction}_node") - node.cypher_representation(self.class.send(:"#{direction}_class")) + def node_cypher_representation(node) + node_class = node.class + id_name = node_class.id_property_name + labels = ':' + node_class.mapped_label_names.join(':') + + "(#{labels} {#{id_name}: #{node.id.inspect}})" end def neo4j_obj _persisted_obj || fail('Tried to access native neo4j object on a non persisted object') end