module Taxonomite::Tree::ClassMethods

Public Instance Methods

leaves() click to toggle source

find all leaves fro this tree (Mongoid query)

# File lib/taxonomite/tree.rb, line 32
def leaves
  where(:_id.nin => only(:parent_id).collect(&:parent_id))
end
roots() click to toggle source

find all roots for this tree (Mongoid query) this would be class wide!!

# File lib/taxonomite/tree.rb, line 26
def roots
  where(:parent_id => nil)
end