Methods

Class/Module Index [+]

Quicksearch

Sequel::Plugins::Tree::SingleRoot::InstanceMethods

Public Instance Methods

before_save() click to toggle source

Hook that prevents a second root from being created.

# File lib/sequel/plugins/tree.rb, line 137
def before_save
  if self[model.parent_column].nil? && (root = model.root) && pk != root.pk
    raise TreeMultipleRootError, "there is already a root #{model.name} defined"
  end
  super
end

[Validate]

Generated with the Darkfish Rdoc Generator 2.