Module: Sequel::Plugins::Tree::DatasetMethods
- Defined in:
- lib/sequel/plugins/tree.rb
Instance Method Summary collapse
-
#roots ⇒ Object
Returns list of all root nodes (those with no parent nodes).
-
#roots_dataset ⇒ Object
Returns the dataset for retrieval of all root nodes.
Instance Method Details
#roots ⇒ Object
Returns list of all root nodes (those with no parent nodes).
TreeClass.roots # => [root1, root2]
151 152 153 |
# File 'lib/sequel/plugins/tree.rb', line 151 def roots roots_dataset.all end |
#roots_dataset ⇒ Object
Returns the dataset for retrieval of all root nodes
TreeClass.roots_dataset # => Sequel::Dataset instance
158 159 160 161 162 |
# File 'lib/sequel/plugins/tree.rb', line 158 def roots_dataset ds = where(Sequel.or(Array(model.qualified_parent_column).zip([]))) ds = ds.order(*model.tree_order) if model.tree_order ds end |