Sha256: 0a9f082c7baa6a06a47aa80ba02b69d9eb31c233c5cd0e3d788096d9c89635ed

Contents?: true

Size: 338 Bytes

Versions: 1

Compression:

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