demarches-normaliennes/app/models/avis.rb

13 lines
308 B
Ruby
Raw Normal View History

2017-04-25 12:09:11 +02:00
class Avis < ApplicationRecord
belongs_to :dossier
belongs_to :gestionnaire
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) }
def email_to_display
gestionnaire.try(:email) || email
end
2017-04-25 12:09:11 +02:00
end