Skip to content

Instantly share code, notes, and snippets.

@milushov
Created August 21, 2015 03:05
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save milushov/82832492356f6730bfa2 to your computer and use it in GitHub Desktop.
Save milushov/82832492356f6730bfa2 to your computer and use it in GitHub Desktop.
def self.stupid_arrange
arranged = ActiveSupport::OrderedHash.new
self.sorted.where(depth: 0).each do |item|
arranged[item] = []
end
self.sorted.where(depth: 1).each do |item|
if key = arranged.find{ |k, _| k.id == 54 }.first
arranged[key].push(item)
end
end
arranged
end
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment