module Sequel::Plugins::Tree::DatasetMethods

  1. lib/sequel/plugins/tree.rb

Methods

Public Instance

  1. roots
  2. roots_dataset

Public Instance methods

roots()

Returns list of all root nodes (those with no parent nodes).

TreeClass.roots # => [root1, root2]
[show source]
    # File lib/sequel/plugins/tree.rb
151 def roots
152   roots_dataset.all
153 end
roots_dataset()

Returns the dataset for retrieval of all root nodes

TreeClass.roots_dataset # => Sequel::Dataset instance
[show source]
    # File lib/sequel/plugins/tree.rb
158 def roots_dataset
159   ds = where(Sequel.or(Array(model.qualified_parent_column).zip([])))
160   ds = ds.order(*model.tree_order) if model.tree_order
161   ds
162 end