Skip to content

Commit

Permalink
arrange no longer clears order in default scope
Browse files Browse the repository at this point in the history
issue introduced by 75cf67e
  • Loading branch information
kbrock committed Nov 2, 2018
1 parent cbaa20a commit ac994f5
Showing 1 changed file with 6 additions and 3 deletions.
9 changes: 6 additions & 3 deletions lib/ancestry/class_methods.rb
Original file line number Diff line number Diff line change
Expand Up @@ -27,10 +27,13 @@ def orphan_strategy= orphan_strategy
end
end

# Arrangement
# Get all nodes and sorting them into an empty hash
def arrange options = {}
# Get all nodes ordered by ancestry and start sorting them into an empty hash
arrange_nodes self.ancestry_base_class.reorder(options.delete(:order)).where(options)
if (order = options.delete(:order))
arrange_nodes self.ancestry_base_class.order(order).where(options)
else
arrange_nodes self.ancestry_base_class.where(options)
end
end

# Arrange array of nodes into a nested hash of the form
Expand Down

0 comments on commit ac994f5

Please sign in to comment.