From 3536a1856756d2cc43a01b855af8eed5770f44d4 Mon Sep 17 00:00:00 2001 From: andreas Date: Mon, 5 Oct 2009 21:00:31 +0200 Subject: [PATCH] Fixed appending (<<) on incoming relationships [#80 state:resolved] node1.relationships.incoming(:friends) << node2 did not work as expeced --- lib/neo4j/relationships/relationship_traverser.rb | 4 +++- test/neo4j/relation_traverser_spec.rb | 1 - 2 files changed, 3 insertions(+), 2 deletions(-) diff --git a/lib/neo4j/relationships/relationship_traverser.rb b/lib/neo4j/relationships/relationship_traverser.rb index de9b0b3cf..9fc23df5a 100644 --- a/lib/neo4j/relationships/relationship_traverser.rb +++ b/lib/neo4j/relationships/relationship_traverser.rb @@ -56,7 +56,9 @@ def both(type = nil) # # :api: public def <<(other_node) - @node._create_relationship(@type.to_s, other_node) + source,target = @node, other_node + source,target = target,source if @direction == org.neo4j.api.core.Direction::INCOMING + source._create_relationship(@type.to_s, target) end def empty? diff --git a/test/neo4j/relation_traverser_spec.rb b/test/neo4j/relation_traverser_spec.rb index 90b25a940..bf54a43f2 100644 --- a/test/neo4j/relation_traverser_spec.rb +++ b/test/neo4j/relation_traverser_spec.rb @@ -43,7 +43,6 @@ describe 'n1.relationships.incoming(:foo) << n2' do it "should append n2 as incoming node to n1" do - pending "see lighthouse ticket 80, http://neo4j.lighthouseapp.com/projects/15548-neo4j/tickets/80-n1relationshipsincomingfoo-n2-does-not-work-as-expected" n1 = Neo4j::Node.new n2 = Neo4j::Node.new