Class: ActiveModel::Validations::SsnValidator
- Inherits:
-
EachValidator
- Object
- EachValidator
- ActiveModel::Validations::SsnValidator
- Defined in:
- lib/active_model/validations/ssn_validator.rb
Instance Method Summary collapse
Instance Method Details
#validate_each(record, attribute, value) ⇒ Object
4 5 6 7 |
# File 'lib/active_model/validations/ssn_validator.rb', line 4 def validate_each(record, attribute, value) type = .fetch(:type, :usa_ssn) # :usa_ssn is default. record.errors.add(attribute) if value.blank? || !SsnValidatorGeneral.valid?(type, value) end |