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

Public Instance Methods

before_save() click to toggle source

Hook that prevents a second root from being created.

Calls superclass method
    # File lib/sequel/plugins/tree.rb
171 def before_save
172   if possible_root? && (root = model.root) && pk != root.pk
173     raise TreeMultipleRootError, "there is already a root #{model.name} defined"
174   end
175   super
176 end