summaryrefslogtreecommitdiff
path: root/app/models/concerns
diff options
context:
space:
mode:
authorDavid Gay <david@davidgay.org>2021-06-03 19:55:55 -0400
committerDavid Gay <david@davidgay.org>2021-06-03 19:55:55 -0400
commit2cb92046ebe697d6e17c78e968ec1bcf528487f0 (patch)
tree95a3d1de321573590dd6e46d3028d8ef92867122 /app/models/concerns
parent888bcdc0492ff3587e9f2916993a82b9f27c61f1 (diff)
Only allow one food condition per character
Diffstat (limited to 'app/models/concerns')
-rw-r--r--app/models/concerns/has_whatnot.rb6
1 files changed, 5 insertions, 1 deletions
diff --git a/app/models/concerns/has_whatnot.rb b/app/models/concerns/has_whatnot.rb
index 289fe40..a0934ef 100644
--- a/app/models/concerns/has_whatnot.rb
+++ b/app/models/concerns/has_whatnot.rb
@@ -7,7 +7,11 @@ module HasWhatnot
end
def tags
- whatnot[:tags] if whatnot
+ whatnot[:tags] ? whatnot[:tags] : []
+ end
+
+ def where_has_tag(tag)
+ where("whatnot->'tags' ? :tag", tag: tag)
end
end
end