Skip to content

Commit

Permalink
nested_set_scope method is already scoped
Browse files Browse the repository at this point in the history
  • Loading branch information
Sasha committed Nov 9, 2011
1 parent fa2cb0a commit e1ddcdd
Showing 1 changed file with 5 additions and 5 deletions.
10 changes: 5 additions & 5 deletions lib/nested_set/base.rb
Original file line number Diff line number Diff line change
Expand Up @@ -401,12 +401,12 @@ def root

# Returns the array of all children and self
def self_and_children
nested_set_scope.scoped.where("#{q_parent} = ? or id = ?", id, id)
nested_set_scope.where("#{q_parent} = ? or id = ?", id, id)
end

# Returns the array of all parents and self
def self_and_ancestors
nested_set_scope.scoped.where("#{q_left} <= ? AND #{q_right} >= ?", left, right)
nested_set_scope.where("#{q_left} <= ? AND #{q_right} >= ?", left, right)
end

# Returns an array of all parents
Expand All @@ -416,7 +416,7 @@ def ancestors

# Returns the array of all children of the parent, including self
def self_and_siblings
nested_set_scope.scoped.where(parent_column_name => parent_id)
nested_set_scope.where(parent_column_name => parent_id)
end

# Returns the array of all children of the parent, except self
Expand All @@ -426,7 +426,7 @@ def siblings

# Returns a set of all of its nested children which do not have children
def leaves
descendants.scoped.where("#{q_right} - #{q_left} = 1")
descendants.where("#{q_right} - #{q_left} = 1")
end

# Returns the level of this object in the tree
Expand All @@ -437,7 +437,7 @@ def level

# Returns a set of itself and all of its nested children
def self_and_descendants
nested_set_scope.scoped.where("#{q_left} >= ? AND #{q_right} <= ?", left, right)
nested_set_scope.where("#{q_left} >= ? AND #{q_right} <= ?", left, right)
end

# Returns a set of all of its children and nested children
Expand Down

0 comments on commit e1ddcdd

Please sign in to comment.