From 9833564863df6f8f70b4397aac172f4684a93a91 Mon Sep 17 00:00:00 2001 From: gregoirenovel Date: Tue, 11 Sep 2018 09:49:33 +0200 Subject: [PATCH] [#835] Add a missing validation to avis --- app/models/avis.rb | 1 + 1 file changed, 1 insertion(+) diff --git a/app/models/avis.rb b/app/models/avis.rb index f0b9eb6ec..024323fea 100644 --- a/app/models/avis.rb +++ b/app/models/avis.rb @@ -6,6 +6,7 @@ class Avis < ApplicationRecord belongs_to :claimant, class_name: 'Gestionnaire' validates :email, format: { with: Devise.email_regexp, message: "n'est pas valide" }, allow_nil: true + validates :claimant, presence: true before_validation -> { sanitize_email(:email) } before_create :try_to_assign_gestionnaire