Permalink
Browse files

Merge branch 'master' of git://github.com/jho406/neo4j

  • Loading branch information...
2 parents 33d583c + 039bef6 commit 8af54bd338114dc84598dc87f42463481feb437f andreas committed Oct 5, 2009
Showing with 8 additions and 4 deletions.
  1. +4 −2 lib/neo4j/extensions/reindexer.rb
  2. +4 −2 test/neo4j/reindexer_spec.rb
View
6 lib/neo4j/extensions/reindexer.rb
@@ -19,7 +19,7 @@ def update_index
# :api: public
def all
index_node = IndexNode.instance
- index_node.relationships.outgoing(root_class)
+ index_node.relationships.outgoing(self)
end
end
@@ -53,7 +53,9 @@ def connect(node, type = node.class.root_class)
def on_node_created(node)
# we have to avoid connecting to our self
- connect(node) unless self == node
+ unless self == node
+ node.class.ancestors.grep(Class).each{|p| connect(node, p) if p.respond_to?(:all)}
+ end
end
def self.on_neo_started(neo_instance)
View
6 test/neo4j/reindexer_spec.rb
@@ -135,7 +135,7 @@ class TestNode
TestNode.all.nodes.to_a.should include(t2)
end
- it "should return subclasses instances as well" do
+ it "should return subclasses instances if subclassed" do
class A
include Neo4j::NodeMixin
end
@@ -149,7 +149,9 @@ class B < A
# then
A.all.to_a.size.should == 2
- B.all.nodes.to_a.should include(a, b)
+ A.all.nodes.to_a.should include(a, b)
+ B.all.to_a.size.should == 1
+ B.all.nodes.to_a.should include(b)
end
end

0 comments on commit 8af54bd

Please sign in to comment.