Module: Mongoid::Tree::ClassMethods
- Defined in:
- lib/mongoid/tree.rb
Overview
This module includes those methods documented above
Instance Method Summary collapse
Instance Method Details
#leaves ⇒ Object
129 130 131 |
# File 'lib/mongoid/tree.rb', line 129 def leaves where(:_id.nin => only(:parent_id).collect(&:parent_id)) end |
#root ⇒ Object
:nodoc:
121 122 123 |
# File 'lib/mongoid/tree.rb', line 121 def root first(:conditions => { :parent_id => nil }) end |
#roots ⇒ Object
125 126 127 |
# File 'lib/mongoid/tree.rb', line 125 def roots where(:parent_id => nil) end |