Module Sequel::Plugins::Tree::SingleRoot::InstanceMethods
In: lib/sequel/plugins/tree.rb

Methods

Public Instance methods

Hook that prevents a second root from being created.

[Source]

     # File lib/sequel/plugins/tree.rb, line 153
153:           def before_save
154:             if possible_root? && (root = model.root) && pk != root.pk
155:               raise TreeMultipleRootError, "there is already a root #{model.name} defined"
156:             end
157:             super
158:           end

[Validate]