From cec447e790a1fe345325235dbd8cee767af9db41 Mon Sep 17 00:00:00 2001 From: baarkerlounger Date: Mon, 11 Apr 2022 18:56:30 +0100 Subject: [PATCH] Remove some of the N+1 query madness by preloading required organisations --- app/controllers/case_logs_controller.rb | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/app/controllers/case_logs_controller.rb b/app/controllers/case_logs_controller.rb index 2402ebe15..3f0e2ea53 100644 --- a/app/controllers/case_logs_controller.rb +++ b/app/controllers/case_logs_controller.rb @@ -130,7 +130,7 @@ private query = query.public_send("filter_by_#{category}", values) end end - query.all + query.all.includes(:owning_organisation, :managing_organisation) end def set_session_filters