Notification: add methods to retrieve notifications

This commit is contained in:
Simon Lehericey 2017-10-05 16:10:00 +02:00 committed by Mathieu Magnin
parent bb147bcb1f
commit 155a5f7826
7 changed files with 235 additions and 0 deletions

View file

@ -12,6 +12,7 @@ class Avis < ApplicationRecord
scope :without_answer, -> { where(answer: nil) }
scope :for_dossier, ->(dossier_id) { where(dossier_id: dossier_id) }
scope :by_latest, -> { order(updated_at: :desc) }
scope :updated_since?, -> (date) { where('avis.updated_at > ?', date) }
def email_to_display
gestionnaire.try(:email) || email