refactor(messagerie): preload commentaires with corrections & attachments blobs

This commit is contained in:
Colin Darie 2023-06-02 15:46:58 +02:00
parent 7f871728c7
commit b1bcc784bb
No known key found for this signature in database
GPG key ID: 4FB865FDBCA4BCC4
2 changed files with 3 additions and 1 deletions

View file

@ -99,6 +99,8 @@ class Dossier < ApplicationRecord
has_many :prefilled_champs_public, -> { root.public_only.prefilled }, class_name: 'Champ', inverse_of: false
has_many :commentaires, inverse_of: :dossier, dependent: :destroy
has_many :preloaded_commentaires, -> { includes(:dossier_correction, piece_jointe_attachment: :blob) }, class_name: 'Commentaire', inverse_of: :dossier
has_many :invites, dependent: :destroy
has_many :follows, -> { active }, inverse_of: :dossier
has_many :previous_follows, -> { inactive }, class_name: 'Follow', inverse_of: :dossier