From c6cfd6a12babd2a0fe94d090d337d3cec66e1a0d Mon Sep 17 00:00:00 2001 From: baarkerlounger Date: Mon, 23 May 2022 16:57:34 +0100 Subject: [PATCH] Preload org --- app/controllers/organisations_controller.rb | 2 +- app/controllers/users_controller.rb | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/app/controllers/organisations_controller.rb b/app/controllers/organisations_controller.rb index 12bf285d2..d29d894c5 100644 --- a/app/controllers/organisations_controller.rb +++ b/app/controllers/organisations_controller.rb @@ -63,7 +63,7 @@ private User.search_by(search_param) else User.all - end.filter_by_active + end.filter_by_active.includes(:organisation) end def org_params diff --git a/app/controllers/users_controller.rb b/app/controllers/users_controller.rb index cb3b5fc51..52ded2ebe 100644 --- a/app/controllers/users_controller.rb +++ b/app/controllers/users_controller.rb @@ -82,7 +82,7 @@ private User.search_by(search_param) else User.all - end.filter_by_active + end.filter_by_active.includes(:organisation) end def format_error_messages