2018-03-06 13:44:29 +01:00
|
|
|
class Follow < ApplicationRecord
|
2016-07-18 18:24:29 +02:00
|
|
|
belongs_to :gestionnaire
|
|
|
|
belongs_to :dossier
|
|
|
|
|
2018-03-06 13:44:29 +01:00
|
|
|
validates :gestionnaire_id, uniqueness: { scope: :dossier_id }
|
2017-10-23 10:25:07 +02:00
|
|
|
|
|
|
|
before_create :set_default_date
|
|
|
|
|
|
|
|
private
|
|
|
|
|
|
|
|
def set_default_date
|
2017-12-05 16:07:05 +01:00
|
|
|
self.demande_seen_at ||= DateTime.now
|
|
|
|
self.annotations_privees_seen_at ||= DateTime.now
|
|
|
|
self.avis_seen_at ||= DateTime.now
|
|
|
|
self.messagerie_seen_at ||= DateTime.now
|
2017-10-23 10:25:07 +02:00
|
|
|
end
|
2017-04-04 15:27:04 +02:00
|
|
|
end
|