| 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 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