Notification: add gestionnaire.procedures_with_email_notifications scope

This commit is contained in:
simon lehericey 2019-03-18 14:43:05 +01:00
parent 7077153e7e
commit 1644fd9059
4 changed files with 13 additions and 1 deletions

View file

@ -3,6 +3,8 @@ class AssignTo < ApplicationRecord
belongs_to :gestionnaire
has_one :procedure_presentation, dependent: :destroy
scope :with_email_notifications, -> { where(email_notifications_enabled: true) }
def procedure_presentation_or_default_and_errors
errors = reset_procedure_presentation_if_invalid
[procedure_presentation || build_procedure_presentation, errors]