Class: Scorecard::UserBadge

Inherits:
ActiveRecord::Base
  • Object
show all
Defined in:
app/models/scorecard/user_badge.rb

Class Method Summary collapse

Class Method Details

.for(badge, user) ⇒ Object



17
18
19
# File 'app/models/scorecard/user_badge.rb', line 17

def self.for(badge, user)
  for_user(user).where badge: badge
end

.for_gameable(gameable) ⇒ Object



25
26
27
# File 'app/models/scorecard/user_badge.rb', line 25

def self.for_gameable(gameable)
  where gameable_id: gameable.id, gameable_type: gameable.class.name
end

.for_user(user) ⇒ Object



21
22
23
# File 'app/models/scorecard/user_badge.rb', line 21

def self.for_user(user)
  where user_id: user.id, user_type: user.class.name
end