Class: Validators::AbsenceValidator
- Inherits:
-
ActiveModel::EachValidator
- Object
- ActiveModel::EachValidator
- Validators::AbsenceValidator
- Defined in:
- lib/validators/absence_validator.rb
Overview
Checks that an attribute is absent. The opposite of PresenceValidator
Instance Method Summary (collapse)
Instance Method Details
- (Object) validate_each(record, attribute, value)
7 8 9 |
# File 'lib/validators/absence_validator.rb', line 7 def validate_each(record, attribute, value) record.errors.add(attribute, :invalid, ) unless value.blank? end |