Class: ActiveModel::Validations::CompanyTaxIdFormatValidator
- Inherits:
-
EachValidator
- Object
- EachValidator
- ActiveModel::Validations::CompanyTaxIdFormatValidator
- Defined in:
- lib/format_validator/company_tax_id_format_validator.rb
Instance Method Summary collapse
Instance Method Details
#validate_each(object, attribute, value) ⇒ Object
4 5 6 7 8 |
# File 'lib/format_validator/company_tax_id_format_validator.rb', line 4 def validate_each(object, attribute, value) unless value =~ /\A\d{2}-?\d{7}\z/ object.errors[attribute] << ([:message] || I18n.t('form.errors.ssn')) end end |