Module: MakeTaggable::Taggable::Collection

Defined in:
lib/make_taggable/taggable/collection.rb

Overview

Counting tags, for tag clouds and "most used" lists.

Each context gets <context>_counts and top_<context> on both the class and its instances.

Defined Under Namespace

Modules: CalculationMethods, ClassMethods

Class Method Summary collapse

Instance Method Summary collapse

Class Method Details

.included(base) ⇒ void

This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.

This method returns an undefined value.

Parameters:

  • base (Class)

    the model being made taggable



16
17
18
19
# File 'lib/make_taggable/taggable/collection.rb', line 16

def self.included(base)
  base.extend MakeTaggable::Taggable::Collection::ClassMethods
  base.initialize_make_taggable_collection
end

Instance Method Details

#tag_counts_on(context, options = {}) ⇒ ActiveRecord::Relation

Tags used on this record in one context, each carrying how often it was used.

Parameters:

Returns:

  • (ActiveRecord::Relation)


266
267
268
# File 'lib/make_taggable/taggable/collection.rb', line 266

def tag_counts_on(context, options = {})
  self.class.tag_counts_on(context, options.merge(id: id))
end