Sha256: d7d29f79677934e7b733a3e8a59d00acb63eef7c7ef4f631760d7e6398803aa8

Contents?: true

Size: 344 Bytes

Versions: 1

Compression:

Stored size: 344 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.2 lib/gamification/concerns/rewardable.rb