Class: CpfValidator
- Inherits:
-
ActiveModel::EachValidator
- Object
- ActiveModel::EachValidator
- CpfValidator
- Defined in:
- lib/cpf_validator.rb
Defined Under Namespace
Classes: Cpf
Instance Method Summary collapse
Instance Method Details
#validate_each(record, attribute, value) ⇒ Object
4 5 6 7 |
# File 'lib/cpf_validator.rb', line 4 def validate_each(record, attribute, value) = [:message].presence || :invalid record.errors.add(attribute, ) unless Cpf.valid?(value) end |