Avoid N+1 query in foreman hosts index by declaring proper scope
Add this to plugin declaration:
add_controller_action_scope(::Api::V2::HostsController, :index) do |base_scope| base_scope.includes(:policies) end
Fixes #18841 - Added policies to hosts index api scope
Policies are loaded while calculating compliance status, to avoid
N+1 query we are preloading them.
#3 Updated by Shimon Shtein almost 2 years ago
- Status changed from Ready For Testing to Closed
- % Done changed from 0 to 100
Applied in changeset foreman_openscap|901f778720f441746e296edd363f8a37c5e73975.