Class: ActsAsOrderedTree::Validators::CyclicReferenceValidator
- Inherits:
-
ActiveModel::Validator
- Object
- ActiveModel::Validator
- ActsAsOrderedTree::Validators::CyclicReferenceValidator
- Defined in:
- lib/acts_as_ordered_tree/validators.rb
Instance Method Summary collapse
Instance Method Details
#validate(record) ⇒ Object
4 5 6 |
# File 'lib/acts_as_ordered_tree/validators.rb', line 4 def validate(record) record.errors.add(:parent, :invalid) if record.is_or_is_ancestor_of?(record.parent) end |