Skip to content

Commit

Permalink
Updated #arrange to use ActiveSupport::OrderedHash so ordering also w…
Browse files Browse the repository at this point in the history
…orks in Ruby 1.8.
  • Loading branch information
muitocomplicado authored and stefankroes committed Sep 11, 2010
1 parent 067fa51 commit fa73096
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion lib/ancestry/class_methods.rb
Expand Up @@ -36,7 +36,7 @@ def arrange options = {}
self.base_class.ordered_by_ancestry_and options.delete(:order)
end
# Get all nodes ordered by ancestry and start sorting them into an empty hash
scope.all(options).inject({}) do |arranged_nodes, node|
scope.all(options).inject(ActiveSupport::OrderedHash.new) do |arranged_nodes, node|
# Find the insertion point for that node by going through its ancestors
node.ancestor_ids.inject(arranged_nodes) do |insertion_point, ancestor_id|
insertion_point.each do |parent, children|
Expand Down

0 comments on commit fa73096

Please sign in to comment.