Module: Alchemy::Taggable::ClassMethods
- Defined in:
- lib/alchemy/taggable.rb
Instance Method Summary collapse
-
#tag_counts ⇒ Object
Returns all unique tags.
-
#tagged_with(names) ⇒ Object
Find all records matching all of the given tags.
Instance Method Details
#tag_counts ⇒ Object
Returns all unique tags
34 35 36 37 |
# File 'lib/alchemy/taggable.rb', line 34 def tag_counts Gutentag::Tag.distinct.joins(:taggings) .where(gutentag_taggings: {taggable_type: name}) end |
#tagged_with(names) ⇒ Object
Find all records matching all of the given tags. Separate multiple tags by comma.
26 27 28 29 30 31 |
# File 'lib/alchemy/taggable.rb', line 26 def tagged_with(names) if names.is_a? String names = names.split(/,\s*/) end super(names: names, match: :all) end |