blob: b8eeed7a3e81ebc616e64ef70a543a1a01a9ed0c (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
|
class Activity < ApplicationRecord
include HasWhatnot
belongs_to :location, optional: true
validates :gid, :name, :description, presence: true
def cost_string
requirements = []
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
end
|