discourse/app/serializers/badge_serializer.rb
2014-07-17 16:11:10 +10:00

14 lines
350 B
Ruby

class BadgeSerializer < ApplicationSerializer
attributes :id, :name, :description, :grant_count, :allow_title, :multiple_grant, :icon, :listable, :enabled, :has_badge
has_one :badge_type
has_one :badge_grouping
def include_has_badge?
@options[:user_badges]
end
def has_badge
@options[:user_badges].include?(object.id)
end
end