avoid n+1 queries
This commit is contained in:
parent
dfc97d8d87
commit
f38e16e371
1 changed files with 3 additions and 1 deletions
|
@ -129,6 +129,7 @@ class Dossier < ApplicationRecord
|
||||||
:individual,
|
:individual,
|
||||||
:followers_instructeurs,
|
:followers_instructeurs,
|
||||||
:avis,
|
:avis,
|
||||||
|
:traitements,
|
||||||
etablissement: :champ,
|
etablissement: :champ,
|
||||||
champs: {
|
champs: {
|
||||||
etablissement: :champ,
|
etablissement: :champ,
|
||||||
|
@ -173,6 +174,7 @@ class Dossier < ApplicationRecord
|
||||||
justificatif_motivation_attachment: :blob,
|
justificatif_motivation_attachment: :blob,
|
||||||
attestation: [],
|
attestation: [],
|
||||||
avis: { piece_justificative_file_attachment: :blob },
|
avis: { piece_justificative_file_attachment: :blob },
|
||||||
|
traitements: [],
|
||||||
etablissement: [],
|
etablissement: [],
|
||||||
individual: [],
|
individual: [],
|
||||||
user: [])
|
user: [])
|
||||||
|
@ -249,7 +251,7 @@ class Dossier < ApplicationRecord
|
||||||
end
|
end
|
||||||
|
|
||||||
scope :for_procedure, -> (procedure) { includes(:user, :groupe_instructeur).where(groupe_instructeurs: { procedure: procedure }) }
|
scope :for_procedure, -> (procedure) { includes(:user, :groupe_instructeur).where(groupe_instructeurs: { procedure: procedure }) }
|
||||||
scope :for_api_v2, -> { includes(procedure: [:administrateurs], etablissement: [], individual: []) }
|
scope :for_api_v2, -> { includes(procedure: [:administrateurs], etablissement: [], individual: [], traitements: []) }
|
||||||
|
|
||||||
scope :with_notifications, -> do
|
scope :with_notifications, -> do
|
||||||
# This scope is meant to be composed, typically with Instructeur.followed_dossiers, which means that the :follows table is already INNER JOINed;
|
# This scope is meant to be composed, typically with Instructeur.followed_dossiers, which means that the :follows table is already INNER JOINed;
|
||||||
|
|
Loading…
Reference in a new issue