discourse/app/serializers/basic_user_badge_serializer.rb

16 lines
296 B
Ruby

# frozen_string_literal: true
class BasicUserBadgeSerializer < ApplicationSerializer
attributes :id, :granted_at, :count, :grouping_position
has_one :badge
def include_count?
object.respond_to? :count
end
def grouping_position
object.badge.badge_grouping.position
end
end