From 499a3b5d4cdb6050d1f8db2ed5e2b9571f92e987 Mon Sep 17 00:00:00 2001 From: raman1236 <25852516+raman1236@users.noreply.github.com> Date: Sat, 30 May 2026 13:17:34 -0500 Subject: [PATCH] Fixes #39381 - Optimize hosts controller query: use pluck instead of map for hostgroup_ids --- app/controllers/hosts_controller.rb | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/app/controllers/hosts_controller.rb b/app/controllers/hosts_controller.rb index 7666c9efee..fdf32cffb6 100644 --- a/app/controllers/hosts_controller.rb +++ b/app/controllers/hosts_controller.rb @@ -53,7 +53,7 @@ def index(title = nil) # SQL optimization preload_reports # rendering index page for non index page requests (out of sync hosts etc) - @hostgroup_authorizer = Authorizer.new(User.current, :collection => @hosts.map(&:hostgroup_id).compact.uniq) + @hostgroup_authorizer = Authorizer.new(User.current, :collection => @hosts.pluck(:hostgroup_id).compact.uniq) render :index if title && (@title = title) end format.csv do