fixup! modify models
This commit is contained in:
parent
ed49d1b110
commit
c92b249340
2 changed files with 3 additions and 2 deletions
|
@ -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?
|
||||
|
|
|
@ -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
|
||||
|
||||
|
|
Loading…
Reference in a new issue