lib/gamification/concerns/rewardable.rb in gamification-1.0.0 vs lib/gamification/concerns/rewardable.rb in gamification-1.0.1
- old
+ new
@@ -4,9 +4,9 @@
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
+ rewards.includes(goal: :medal).collect(&:medal).compact!
end
end
end