diff options
author | David Gay <david@davidgay.org> | 2021-05-28 15:43:23 -0400 |
---|---|---|
committer | David Gay <david@davidgay.org> | 2021-05-28 15:43:23 -0400 |
commit | 41c25cb3ef03aef7725f7717a8bb9c8cec411975 (patch) | |
tree | a3bee718cc79894d60b5de35909d473da40eb919 | |
parent | c913f1d50c428aedef57faa46e8ab0e9cb24741c (diff) |
Add a quick guard to `HearthAmenity#construct_activity`
-rw-r--r-- | app/models/hearth_amenity.rb | 1 |
1 files changed, 1 insertions, 0 deletions
diff --git a/app/models/hearth_amenity.rb b/app/models/hearth_amenity.rb index a5dde23..52ca85e 100644 --- a/app/models/hearth_amenity.rb +++ b/app/models/hearth_amenity.rb @@ -4,6 +4,7 @@ class HearthAmenity < ApplicationRecord 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]) |