diff options
Diffstat (limited to 'app/models')
-rw-r--r-- | app/models/concerns/has_whatnot.rb | 7 |
1 files changed, 6 insertions, 1 deletions
diff --git a/app/models/concerns/has_whatnot.rb b/app/models/concerns/has_whatnot.rb index a0934ef..22322c0 100644 --- a/app/models/concerns/has_whatnot.rb +++ b/app/models/concerns/has_whatnot.rb @@ -7,7 +7,12 @@ module HasWhatnot end def tags - whatnot[:tags] ? whatnot[:tags] : [] + whatnot && whatnot[:tags] ? whatnot[:tags] : [] + end + + def has_tag?(tag) + return false unless tags.any? + tags.include?(tag) end def where_has_tag(tag) |