summaryrefslogtreecommitdiff
path: root/app/models
diff options
context:
space:
mode:
Diffstat (limited to 'app/models')
-rw-r--r--app/models/hearth_amenity.rb4
1 files changed, 3 insertions, 1 deletions
diff --git a/app/models/hearth_amenity.rb b/app/models/hearth_amenity.rb
index f8ebad5..a5dde23 100644
--- a/app/models/hearth_amenity.rb
+++ b/app/models/hearth_amenity.rb
@@ -4,6 +4,8 @@ class HearthAmenity < ApplicationRecord
validates :gid, :name, :description, presence: true
def construct_activity(level)
- Activity.find_by_gid("construct_#{self.name.underscore}_level#{level}")
+ 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