Project

General

Profile

Actions

Bug #18841

closed

Avoid N+1 query in foreman hosts index by declaring proper scope

Added by Shimon Shtein over 7 years ago. Updated over 6 years ago.

Status:
Closed
Priority:
Normal
Assignee:
Target version:
Difficulty:
Triaged:
No
Fixed in Releases:
Found in Releases:

Description

Add this to plugin declaration:

  add_controller_action_scope(::Api::V2::HostsController, :index) do |base_scope|
    base_scope.includes(:policies)
  end
Actions

Also available in: Atom PDF