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.
146 147 148 149 150 151 |
# File 'lib/sequel/plugins/tree.rb', line 146 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 |