module ActsAsTaggableOn::Tagger::ClassMethods

Public Instance Methods

acts_as_tagger(opts={}) click to toggle source

Make a model a tagger. This allows an instance of a model to claim ownership of tags.

Example:

class User < ActiveRecord::Base
  acts_as_tagger
end
# File lib/acts_as_taggable_on/tagger.rb, line 16
def acts_as_tagger(opts={})
  class_eval do
    has_many_with_taggable_compatibility :owned_taggings,
                                         opts.merge(
                                             as: :tagger,
                                             dependent: :destroy,
                                             class_name: '::ActsAsTaggableOn::Tagging'
                                         )

    has_many_with_taggable_compatibility :owned_tags,
                                         through: :owned_taggings,
                                         source: :tag,
                                         class_name: '::ActsAsTaggableOn::Tag',
                                         uniq: true
  end

  include ActsAsTaggableOn::Tagger::InstanceMethods
  extend ActsAsTaggableOn::Tagger::SingletonMethods
end
is_tagger?() click to toggle source
# File lib/acts_as_taggable_on/tagger.rb, line 40
def is_tagger?
  tagger?
end
tagger?() click to toggle source
# File lib/acts_as_taggable_on/tagger.rb, line 36
def tagger?
  false
end