Module: Alchemy::Taggable::ClassMethods
- Defined in:
- app/models/concerns/alchemy/taggable.rb
Instance Method Summary collapse
-
#tag_counts ⇒ Object
Returns all unique tags.
- #tagged_with(names = [], **args) ⇒ Object
Instance Method Details
#tag_counts ⇒ Object
Returns all unique tags
86 87 88 89 |
# File 'app/models/concerns/alchemy/taggable.rb', line 86 def tag_counts Gutentag::Tag.distinct.joins(:taggings) .where(gutentag_taggings: {taggable_type: name}) end |
#tagged_with(names = [], **args) ⇒ Object
69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 |
# File 'app/models/concerns/alchemy/taggable.rb', line 69 def tagged_with(names = [], **args) if names.is_a? String names = names.split(/,\s*/) end unless args[:match] args[:match] = :all end if names.any? args[:names] = names end super(args) end |