From 983dba37cef1eac94f33b268fc19ab5efc87feaf Mon Sep 17 00:00:00 2001 From: Kyle Zhao Date: Mon, 13 Aug 2018 18:11:14 -0400 Subject: [PATCH] FIX: use BasicUserSerializer for user_badge.granted_by (#6266) BasicUserSerializer contains enough information for the badges page, while UserSerializer issues ~100 SQL queries on the fly when serializing the field without preloading. --- app/serializers/detailed_user_badge_serializer.rb | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/app/serializers/detailed_user_badge_serializer.rb b/app/serializers/detailed_user_badge_serializer.rb index b32f72b6b85..91c52562dfd 100644 --- a/app/serializers/detailed_user_badge_serializer.rb +++ b/app/serializers/detailed_user_badge_serializer.rb @@ -1,5 +1,5 @@ class DetailedUserBadgeSerializer < BasicUserBadgeSerializer - has_one :granted_by + has_one :granted_by, serializer: UserBadgeSerializer::UserSerializer attributes :post_number, :topic_id, :topic_title