Permalink
Browse files

Fix for JRuby 1.7.1, closes #225

Use the neo4j-wrapper impl. of equal instead of the neo4j-core java equals
  • Loading branch information...
andreasronge committed Dec 17, 2012
1 parent 022d939 commit e1efebe39e61c211b425fb5e069b29e58ce93bd9
View
@@ -1,3 +1,5 @@
+* Fix for create nodes and relationship using Cypher (neo4j-core #17)
+
== 2.2.0 / 2012-10-02
* Using neo4j-cypher gem (1.0.0)
* Fix of neo4j-core configuration issue using boolean values #218
@@ -15,10 +15,9 @@ def getId
end
def ==(other)
- new? ? self.__id__ == other.__id__ : _java_entity == (other)
+ new? ? self.__id__ == other.__id__ : super(other)
end
-
end
end
end
@@ -44,7 +44,7 @@ def other_node(node)
if persisted?
_java_rel._other_node(node._java_entity)
else
- @_start_node == (node._java_entity || node) ? @_end_node : @_start_node
+ @_start_node == node ? @_end_node : @_start_node
end
end
@@ -30,7 +30,7 @@ def size
# Notice, only persisted relationships will be returned.
def to_other(other)
raise('node.rels(...).to_other() not allowed on a node that is not persisted') unless @node
- @node._java_node.rels(@dir).to_other(other)
+ @node._java_node.rels(@dir).to_other(other._java_node)
end
def delete_all
@@ -48,7 +48,7 @@ def count(dir)
def to_other(dir, other)
raise('node.rels(...).to_other() not allowed on a node that is not persisted') if @node.new_record?
all_relationships(dir).find_all do |rel|
- rel._other_node(@node) == other
+ rel._other_node(@node) == other._java_node
end
end
@@ -151,6 +151,7 @@ def destroy_rels(dir, *nodes)
end
def create_relationship_to(to, dir, attributes=nil)
+# puts "create_relationship_to #{@node.class}/#{@node.neo_id}, to #{to.class}/#{to.neo_id}"
if dir == :outgoing
@rel_class.new(@rel_type, @node, to, attributes)
else
View
@@ -32,5 +32,5 @@ It comes included with the Apache Lucene document database.
s.add_dependency('orm_adapter', ">= 0.0.3")
s.add_dependency("activemodel", ">= 3.0.0", "< 3.3")
s.add_dependency("railties", ">= 3.0.0", "< 3.3")
- s.add_dependency("neo4j-wrapper", '2.2.0')
+ s.add_dependency("neo4j-wrapper", '2.2.1')
end
@@ -13,7 +13,7 @@
it "always reset the threadlocal_ref_node" do
my_ref_node = Neo4j::Rails::Model.create
Neo4j.threadlocal_ref_node = my_ref_node
- Neo4j.ref_node.should == my_ref_node
+ Neo4j.ref_node.should == my_ref_node._java_node
app = mock('app')
closer = Neo4j::Rails::Middleware.new(app)
@@ -47,7 +47,7 @@ module Validations
it "returns old if it already exists" do
old = get_or_create_class.get_or_create(:name => 'abc', :email => 'email@old.se')
new = get_or_create_class.get_or_create(:name => 'def', :email => 'email@old.se')
- new.should == old
+ new._java_node.should == old._java_node
new[:name].should == 'abc'
new[:email].should == 'email@old.se'
end
@@ -80,7 +80,7 @@
b = klass.new.mock_save(java_node_b = MockNode.new)
a.friends << b
- Neo4j::Relationship.should_receive(:new).with(:friends, java_node_a, java_node_b).and_return(MockRelationship.new(:friends, java_node_a, java_node_b))
+ Neo4j::Relationship.should_receive(:new).with(:friends, a, b).and_return(MockRelationship.new(:friends, java_node_a, java_node_b))
a.save
java_node_a.should_receive(:_rels).with(:outgoing, :friends).and_return([b])
a.friends.count.should == 1

0 comments on commit e1efebe

Please sign in to comment.