Class: ActiveModel::Validations::SiretValidator
- Inherits:
-
EachValidator
- Object
- EachValidator
- ActiveModel::Validations::SiretValidator
- Defined in:
- lib/siret_validator.rb
Constant Summary collapse
- LA_POSTE_SIREN =
"356000000"- LA_POSTE_SIRET_SIEGE =
"35600000000048"
Instance Method Summary collapse
Instance Method Details
#validate_each(record, attribute, value) ⇒ Object
13 14 15 16 17 18 19 |
# File 'lib/siret_validator.rb', line 13 def validate_each(record, attribute, value) if !valid_format?(value) record.errors.add(attribute, :wrong_siret_format, **) elsif !valid_checksum?(value) record.errors.add(attribute, :invalid, **) end end |