discourse/app/serializers/badge_serializer.rb

14 lines
350 B
Ruby
Raw Normal View History

2014-03-05 06:52:20 -06:00
class BadgeSerializer < ApplicationSerializer
attributes :id, :name, :description, :grant_count, :allow_title, :multiple_grant, :icon, :listable, :enabled, :has_badge
2014-03-05 06:52:20 -06:00
has_one :badge_type
2014-07-17 01:10:44 -05:00
has_one :badge_grouping
def include_has_badge?
@options[:user_badges]
end
def has_badge
@options[:user_badges].include?(object.id)
end
2014-03-05 06:52:20 -06:00
end