Module: Taxonomite::Tree::ClassMethods
- Defined in:
- lib/taxonomite/tree.rb
Instance Method Summary collapse
-
#leaves ⇒ Object
find all leaves fro this tree (Mongoid query).
-
#roots ⇒ Object
find all roots for this tree (Mongoid query) this would be class wide!!.
Instance Method Details
#leaves ⇒ Object
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 |
#roots ⇒ Object
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 |