Class: Dag::UpdateCorrectnessValidator
- Inherits:
-
ActiveModel::Validator
- Object
- ActiveModel::Validator
- Dag::UpdateCorrectnessValidator
- Defined in:
- lib/dag/validators.rb
Overview
Validations on update. Makes sure that something changed, that not making a lonely link indirect, and count is correct.
Instance Method Summary collapse
Instance Method Details
#validate(record) ⇒ Object
41 42 43 44 45 |
# File 'lib/dag/validators.rb', line 41 def validate(record) record.errors[:base] << "No changes" unless record.changed? record.errors[:base] << "Do not manually change the count value" if manual_change(record) record.errors[:base] << "Cannot make a direct link with count 1 indirect" if direct_indirect(record) end |