Sha256: 334d3ab6b3e7d0384ce13e5a5226dfd2173e56d34a105dce0c5d9b118d0b79c4

Contents?: true

Size: 322 Bytes

Versions: 1

Compression:

Stored size: 322 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.map(&:goal).map(&:medal).flatten
    end
  end
end

Version data entries

1 entries across 1 versions & 1 rubygems

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