fixup! modify models

This commit is contained in:
kara Diaby 2021-07-22 14:30:48 +02:00
parent ed49d1b110
commit c92b249340
2 changed files with 3 additions and 2 deletions

View file

@ -18,7 +18,7 @@ class Commentaire < ApplicationRecord
belongs_to :instructeur, optional: true
belongs_to :expert, optional: true
validate :messagerie_available?, on: :create
validate :messagerie_available?, on: :create, unless: -> { dossier.brouillon? }
has_one_attached :piece_jointe
@ -95,7 +95,7 @@ class Commentaire < ApplicationRecord
end
def notify_user
DossierMailer.notify_new_answer(dossier).deliver_later
DossierMailer.notify_new_answer(dossier, body).deliver_later
end
def messagerie_available?

View file

@ -26,6 +26,7 @@ class Instructeur < ApplicationRecord
has_many :previously_followed_dossiers, -> { distinct }, through: :previous_follows, source: :dossier
has_many :trusted_device_tokens, dependent: :destroy
has_many :archives
has_many :bulk_messages, dependent: :destroy
has_one :user, dependent: :nullify