Module | Sequel::Plugins::Tree::SingleRoot::InstanceMethods |
In: |
lib/sequel/plugins/tree.rb
|
Hook that prevents a second root from being created.
# File lib/sequel/plugins/tree.rb, line 138 138: def before_save 139: if self[model.parent_column].nil? && (root = model.root) && pk != root.pk 140: raise TreeMultipleRootError, "there is already a root #{model.name} defined" 141: end 142: super 143: end