Permalink
Browse files

Added "parent_column_name => nil" condition to root method. Previous …

…version assumed that the DB would return the root node first, otherwise root would not return a root node.
  • Loading branch information...
1 parent 6570b03 commit c5b244d3e2b194b34b3fcdf1e38941b6e1bc5196 Zack Ham committed with danielmorrison Nov 17, 2010
Showing with 1 addition and 1 deletion.
  1. +1 −1 lib/awesome_nested_set/awesome_nested_set.rb
View
2 lib/awesome_nested_set/awesome_nested_set.rb
@@ -242,7 +242,7 @@ def child?
# Returns root
def root
- self_and_ancestors.first
+ self_and_ancestors.where(parent_column_name => nil).first
end
# Returns the array of all parents and self

0 comments on commit c5b244d

Please sign in to comment.