7
8
9
10
11
12
13
14
15
16
17
18
19
20
|
# File 'lib/italian_job/validators/partita_iva_format.rb', line 7
def validate_each(object, attribute, value)
if value.blank?
object.errors[attribute] << I18n.translate("activerecord.errors.partita_iva.empty")
return
end
unless value.match(REGEX)
object.errors[attribute] << I18n.translate("activerecord.errors.partita_iva.invalid_format")
return
end
unless control_code_valid?(value)
object.errors[attribute] << I18n.translate("activerecord.errors.partita_iva.invalid_format")
return
end
end
|