[#835] Add a missing validation to avis

This commit is contained in:
gregoirenovel 2018-09-11 09:49:33 +02:00 committed by Frederic Merizen
parent 19a6391dc8
commit 9833564863

View file

@ -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