Class: Katello::Validators::PriorValidator
- Inherits:
-
ActiveModel::Validator
- Object
- ActiveModel::Validator
- Katello::Validators::PriorValidator
- Defined in:
- app/lib/katello/validators/prior_validator.rb
Instance Method Summary collapse
Instance Method Details
#validate(record) ⇒ Object
4 5 6 7 8 9 10 11 12 13 |
# File 'app/lib/katello/validators/prior_validator.rb', line 4 def validate(record) # need to ensure that prior # environment already does not have a successor # this is because in v1.0 we want # prior to have only one child (unless its the Library) ancestor = record.prior if ancestor && !ancestor.library? record.errors[:prior] << _("prior environment can only have one child") if ancestor.successors.count == 1 && !ancestor.successors.include?(record) end end |