Sha256: ab6a1535dd808a8e4c8d39631f5748c2f1e62d4764ce4c2b59da5c4ebe0767aa

Contents?: true

Size: 343 Bytes

Versions: 1

Compression:

Stored size: 343 Bytes

Contents

module Gamification::Concerns::Rewardable
  extend ActiveSupport::Concern

  included do
    has_many :rewards, class_name: '::Gamification::Reward', as: :rewardable
    has_many :goals, through: :rewards, class_name: '::Gamification::Goal'

    def medals
      rewards.includes(goal: :medal).collect(&:medal).compact || []
    end
  end
end

Version data entries

1 entries across 1 versions & 1 rubygems

Version Path
gamification-1.0.3 lib/gamification/concerns/rewardable.rb