diff --git a/app/validators/mon_avis_embed_validator.rb b/app/validators/mon_avis_embed_validator.rb index 4e4483988..b4fb33f59 100644 --- a/app/validators/mon_avis_embed_validator.rb +++ b/app/validators/mon_avis_embed_validator.rb @@ -3,7 +3,7 @@ class MonAvisEmbedValidator < ActiveModel::Validator # We need to ensure the embed code is not any random string in order to avoid injections r = Regexp.new('\s*Je donne mon avis\s*', Regexp::MULTILINE) if record.monavis_embed.present? && !r.match?(record.monavis_embed) - record.errors[:base] << "Le code fourni ne correspond pas au format des codes MonAvis reconnus par la plateforme." + record.errors.add :base, :invalid, message: "Le code fourni ne correspond pas au format des codes MonAvis reconnus par la plateforme." end end end