PERF: N+1 queries on badges page.

This commit is contained in:
Guo Xiang Tan 2018-03-19 14:36:09 +08:00
parent ec57ca54b5
commit c1bf707e7d
1 changed files with 1 additions and 1 deletions

View File

@ -14,8 +14,8 @@ class BadgesController < ApplicationController
if (params[:only_listable] == "true") || !request.xhr?
# NOTE: this is sorted client side if needed
badges = badges.includes(:badge_grouping)
.includes(:badge_type)
.where(enabled: true, listable: true)
end
badges = badges.to_a