discourse/app/serializers/badge_serializer.rb

14 lines
350 B
Ruby
Raw Normal View History

2014-03-05 07:52:20 -05:00
class BadgeSerializer < ApplicationSerializer
attributes :id, :name, :description, :grant_count, :allow_title, :multiple_grant, :icon, :listable, :enabled, :has_badge
2014-03-05 07:52:20 -05:00
has_one :badge_type
2014-07-17 02:10:44 -04: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 07:52:20 -05:00
end