discourse/app/serializers/badge_serializer.rb

14 lines
350 B
Ruby
Raw Normal View History

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