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
|
||||
groups = Group.visible_groups(current_user)
|
||||
.where("groups.id <> ?", Group::AUTO_GROUPS[:everyone])
|
||||
.includes(:flair_upload)
|
||||
.order(:name)
|
||||
|
||||
if (term = params[:term]).present?
|
||||
|
|
Loading…
Reference in New Issue