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

  1. lib/sequel/plugins/tree.rb

Methods

Public Instance

  1. before_save

Public Instance methods

before_save()

Hook that prevents a second root from being created.

[show source]
    # File lib/sequel/plugins/tree.rb
176 def before_save
177   if possible_root? && (root = model.root) && pk != root.pk
178     raise TreeMultipleRootError, "there is already a root #{model.name} defined"
179   end
180   super
181 end