Module: Sequel::Plugins::Tree::SingleRoot::InstanceMethods
- Defined in:
- lib/sequel/plugins/tree.rb
Instance Method Summary collapse
-
#before_save ⇒ Object
Hook that prevents a second root from being created.
Instance Method Details
#before_save ⇒ Object
Hook that prevents a second root from being created.
176 177 178 179 180 181 |
# File 'lib/sequel/plugins/tree.rb', line 176 def before_save if possible_root? && (root = model.root) && pk != root.pk raise TreeMultipleRootError, "there is already a root #{model.name} defined" end super end |