mirror of
https://github.com/discourse/discourse.git
synced 2025-02-25 18:55:32 -06:00
FIX: Preload uploads in groups#search to stop N+1 (#10814)
`BasicGroupSerializer` includes `flair_url` which uses `flair_upload` relation, so the N in N+1 in this case was the number of groups with flair in the forum.
This commit is contained in:
parent
01a9c57dcb
commit
4b5358bb42
@ -537,6 +537,7 @@ class GroupsController < ApplicationController
|
|||||||
def search
|
def search
|
||||||
groups = Group.visible_groups(current_user)
|
groups = Group.visible_groups(current_user)
|
||||||
.where("groups.id <> ?", Group::AUTO_GROUPS[:everyone])
|
.where("groups.id <> ?", Group::AUTO_GROUPS[:everyone])
|
||||||
|
.includes(:flair_upload)
|
||||||
.order(:name)
|
.order(:name)
|
||||||
|
|
||||||
if (term = params[:term]).present?
|
if (term = params[:term]).present?
|
||||||
|
Loading…
Reference in New Issue
Block a user