Module: Alchemy::Taggable::ClassMethods
- Defined in:
- lib/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
42 43 44 45 |
# File 'lib/alchemy/taggable.rb', line 42 def tag_counts Gutentag::Tag.distinct.joins(:taggings) .where(gutentag_taggings: {taggable_type: name}) end |
#tagged_with(names = [], **args) ⇒ Object
25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 |
# File 'lib/alchemy/taggable.rb', line 25 def tagged_with(names = [], **args) if names.is_a? String names = names.split(/,\s*/) end unless args[:match] args.merge!(match: :all) end if names.any? args.merge!(names: names) end super(args) end |