FEATURE: show user what badges they have

This commit is contained in:
Sam
2014-07-16 17:53:54 +10:00
parent 986747bfc4
commit e347eea629
4 changed files with 24 additions and 4 deletions

View File

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