Class: ActsAsOrderedTree::Validators::CyclicReferenceValidator

Inherits:
ActiveModel::Validator
  • Object
show all
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