Class: ActiveModel::Validations::Mod11Validator
- Inherits:
-
LuhnValidator
- Object
- EachValidator
- LuhnValidator
- ActiveModel::Validations::Mod11Validator
- Defined in:
- lib/active_model/validations/mod11_validator.rb
Instance Method Summary collapse
Methods inherited from LuhnValidator
Instance Method Details
#validate_each(record, attr_name, value) ⇒ Object
4 5 6 7 8 9 |
# File 'lib/active_model/validations/mod11_validator.rb', line 4 def validate_each(record, attr_name, value) return if [:allow_nil] && value.nil? if valid_number? value, :mod11 record.errors.add(attr_name, ([:message] || :mod11_not_valid)) end end |