Class: UcNumberValidator
- Inherits:
-
ActiveModel::EachValidator
- Object
- ActiveModel::EachValidator
- UcNumberValidator
- Defined in:
- lib/ar_validator.rb
Overview
Provides AR validations for UC Student Numbers.
Instance Method Summary collapse
Instance Method Details
#validate_each(record, attribute, value) ⇒ Object
5 6 7 8 9 |
# File 'lib/ar_validator.rb', line 5 def validate_each(record, attribute, value) unless value.is_a?(String) && value.valid_uc_number? record.errors[attribute] << [:message] || 'is not a valid uc number' end end |