Class: EacRailsUtils::CpfValidator
- Inherits:
-
ActiveModel::EachValidator
- Object
- ActiveModel::EachValidator
- EacRailsUtils::CpfValidator
- Defined in:
- app/validators/eac_rails_utils/cpf_validator.rb
Defined Under Namespace
Classes: Cpf
Instance Method Summary collapse
Instance Method Details
#validate_each(record, attribute, value) ⇒ Object
5 6 7 8 9 10 |
# File 'app/validators/eac_rails_utils/cpf_validator.rb', line 5 def validate_each(record, attribute, value) return if Cpf.new(value).valid? record.errors[attribute] << ([:message] || # rubocop:disable Rails/DeprecatedActiveModelErrorsMethods 'CPF inválido (9 caracteres, somente dígitos)') end |