discourse/app/serializers/badge_index_serializer.rb

14 lines
229 B
Ruby
Raw Normal View History

class BadgeIndexSerializer < BadgeSerializer
attributes :has_badge
has_one :badge_grouping
def include_has_badge?
@options[:user_badges]
end
def has_badge
@options[:user_badges].include?(object.id)
end
2016-04-01 05:33:25 +08:00
end