Eager-load the dossier’s procedure when possible

This commit is contained in:
gregoirenovel 2017-04-13 15:42:54 +02:00
parent 6bb67d639c
commit 14b7badfed
3 changed files with 3 additions and 3 deletions

View file

@ -165,7 +165,7 @@ class Users::DossiersController < UsersController
end
def procedure_libelle
dossier = Dossier.find(params[:dossier_id])
dossier = Dossier.includes(:procedure).find(params[:dossier_id])
render json: { procedureLibelle: dossier.procedure.libelle }
rescue ActiveRecord::RecordNotFound
render json: {}, status: 404