[Fix #658] when dossier linked to avis is hidden, do not crash application

This commit is contained in:
Mathieu Magnin 2017-08-24 16:26:57 +02:00
parent 116398d9d8
commit dd1fea78ac
3 changed files with 13 additions and 1 deletions

View file

@ -6,6 +6,7 @@ class Avis < ApplicationRecord
before_create :try_to_assign_gestionnaire
after_create :notify_gestionnaire
default_scope { joins(:dossier) }
scope :with_answer, -> { where.not(answer: nil) }
scope :without_answer, -> { where(answer: nil) }
scope :for_dossier, ->(dossier_id) { where(dossier_id: dossier_id) }