[Fix #1479] Validate email format with Rails format validation

This commit is contained in:
Mathieu Magnin 2018-02-26 14:51:25 +01:00
parent b7de632d6c
commit e00e8ba01d
2 changed files with 32 additions and 1 deletions

View file

@ -5,5 +5,5 @@ class Invite < ApplicationRecord
validates :email, presence: true
validates :email, uniqueness: { scope: :dossier_id }
validates :email, email_format: true
validates :email, format: { with: Devise.email_regexp, message: "n'est pas valide" }, allow_nil: true
end