blob: 52ca85eac040a5df6b862673fc4d93fcef19ecb6 (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
|
class HearthAmenity < ApplicationRecord
include HasWhatnot
validates :gid, :name, :description, presence: true
def construct_activity(level)
return nil unless self.whatnot
activity_data = self.whatnot[:construct_activities].find { |a| a[:level] == level }
return nil unless activity_data
Activity.find_by_gid(activity_data[:gid])
end
end
|