fix(siret): don't add twice invalid format errors

This commit is contained in:
Colin Darie 2022-07-19 13:04:59 +02:00
parent 64ce2719ed
commit ad52710c3c

View file

@ -2,9 +2,7 @@ class SiretFormatValidator < ActiveModel::EachValidator
def validate_each(record, attribute, value)
if !format_is_valid(value)
record.errors.add(attribute, :length)
end
if !luhn_passed(value)
elsif !luhn_passed(value)
record.errors.add(attribute, :checksum)
end
end