diff options
Diffstat (limited to 'app/models/activity.rb')
-rw-r--r-- | app/models/activity.rb | 9 |
1 files changed, 5 insertions, 4 deletions
diff --git a/app/models/activity.rb b/app/models/activity.rb index e70121e..b8eeed7 100644 --- a/app/models/activity.rb +++ b/app/models/activity.rb @@ -6,10 +6,11 @@ class Activity < ApplicationRecord def cost_string requirements = [] - data = self.whatnot[:cost] - return nil unless data - data[:items].each do |item_gid, quantity| - requirements.push "#{quantity} #{Item.find_by_gid(item_gid).name}" + self.whatnot[:cost].each do |cost| + case cost[:type] + when "item" + requirements.push "#{cost[:quantity]} #{Item.find_by_gid(cost[:gid]).name}" + end end requirements.join(", ") end |