diff --git a/app/models/gestionnaire.rb b/app/models/gestionnaire.rb index a01eddad9..6fc42851d 100644 --- a/app/models/gestionnaire.rb +++ b/app/models/gestionnaire.rb @@ -1,9 +1,14 @@ class Gestionnaire < ApplicationRecord + include CredentialsSyncableConcern + include EmailSanitizableConcern + devise :database_authenticatable, :registerable, :recoverable, :rememberable, :trackable, :validatable has_and_belongs_to_many :administrateurs + before_validation -> { sanitize_email(:email) } + has_many :assign_to, dependent: :destroy has_many :procedures, through: :assign_to has_many :dossiers, -> { state_not_brouillon }, through: :procedures @@ -12,8 +17,6 @@ class Gestionnaire < ApplicationRecord has_many :avis has_many :dossiers_from_avis, through: :avis, source: :dossier - include CredentialsSyncableConcern - def visible_procedures procedures.publiees_ou_archivees end