2017-04-25 12:09:11 +02:00
|
|
|
class Avis < ApplicationRecord
|
|
|
|
belongs_to :dossier
|
|
|
|
belongs_to :gestionnaire
|
2017-04-25 17:02:54 +02:00
|
|
|
|
2017-04-27 12:17:50 +02:00
|
|
|
scope :with_answer, -> { where.not(answer: nil) }
|
|
|
|
scope :without_answer, -> { where(answer: nil) }
|
2017-05-02 13:54:57 +02:00
|
|
|
scope :by_latest, -> { order(updated_at: :desc) }
|
2017-04-27 12:17:50 +02:00
|
|
|
|
2017-04-25 17:02:54 +02:00
|
|
|
def email_to_display
|
|
|
|
gestionnaire.try(:email) || email
|
|
|
|
end
|
2017-04-25 12:09:11 +02:00
|
|
|
end
|