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 137
137:           def before_save
138:             if self[model.parent_column].nil? && (root = model.root) && pk != root.pk
139:               raise TreeMultipleRootError, "there is already a root #{model.name} defined"
140:             end
141:             super
142:           end

[Validate]