diff --git a/lib/ancestry/class_methods.rb b/lib/ancestry/class_methods.rb index 45e8c79f..05940bd6 100644 --- a/lib/ancestry/class_methods.rb +++ b/lib/ancestry/class_methods.rb @@ -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|