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.
This commit is contained in:
Kyle Zhao 2018-08-13 18:11:14 -04:00 committed by Sam
parent 71b65be6f6
commit 983dba37ce

View File

@ -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