remove email_notifications_enabled column because of the new daily_email_notifications_enabled

This commit is contained in:
kara Diaby 2020-02-27 11:09:19 +01:00
parent 4934a6359b
commit 4a70a7fcc8
9 changed files with 14 additions and 16 deletions

View file

@ -3,13 +3,8 @@ class AssignTo < ApplicationRecord
belongs_to :groupe_instructeur
has_one :procedure_presentation, dependent: :destroy
has_one :procedure, through: :groupe_instructeur
before_save :save_to_new_daily_email_column
scope :with_email_notifications, -> { where(email_notifications_enabled: true) }
def save_to_new_daily_email_column
self.daily_email_notifications_enabled = email_notifications_enabled
end
scope :with_email_notifications, -> { where(daily_email_notifications_enabled: true) }
def procedure_presentation_or_default_and_errors
errors = reset_procedure_presentation_if_invalid