2018-03-06 13:44:29 +01:00
|
|
|
class Invite < ApplicationRecord
|
2018-02-26 14:51:25 +01:00
|
|
|
include EmailSanitizableConcern
|
|
|
|
|
2016-02-08 18:16:18 +01:00
|
|
|
belongs_to :dossier
|
|
|
|
belongs_to :user
|
|
|
|
|
2018-02-26 14:51:25 +01:00
|
|
|
before_validation -> { sanitize_email(:email) }
|
|
|
|
|
2018-03-06 13:44:29 +01:00
|
|
|
validates :email, presence: true
|
|
|
|
validates :email, uniqueness: { scope: :dossier_id }
|
2016-02-08 18:16:18 +01:00
|
|
|
|
2018-02-26 14:51:25 +01:00
|
|
|
validates :email, format: { with: Devise.email_regexp, message: "n'est pas valide" }, allow_nil: true
|
2016-02-08 18:16:18 +01:00
|
|
|
end
|