Sha256: 7d3876ce7187ccef0c22aca7507dd9ae0100d67d79d83ccd103c5fa9d12fe293

Contents?: true

Size: 349 Bytes

Versions: 3

Compression:

Stored size: 349 Bytes

Contents

module GoGamification::Concerns::Rewardable
  extend ActiveSupport::Concern

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

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

Version data entries

3 entries across 3 versions & 1 rubygems

Version Path
go_gamification-0.0.7 lib/go_gamification/concerns/rewardable.rb
go_gamification-0.0.6 lib/go_gamification/concerns/rewardable.rb
go_gamification-0.0.4 lib/go_gamification/concerns/rewardable.rb