Module: Taxonomite::Tree::ClassMethods

Defined in:
lib/taxonomite/tree.rb

Instance Method Summary collapse

Instance Method Details

#leavesObject

find all leaves fro this tree (Mongoid query)



32
33
34
# File 'lib/taxonomite/tree.rb', line 32

def leaves
  where(:_id.nin => only(:parent_id).collect(&:parent_id))
end

#rootsObject

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



26
27
28
# File 'lib/taxonomite/tree.rb', line 26

def roots
  where(:parent_id => nil)
end