Module: ActsAsTaggableOn::Tagger::ClassMethods
- Defined in:
- lib/acts_as_taggable_on/tagger.rb
Instance Method Summary collapse
-
#acts_as_tagger(opts = {}) ⇒ Object
Make a model a tagger.
- #is_tagger? ⇒ Boolean
Instance Method Details
#acts_as_tagger(opts = {}) ⇒ Object
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
16 17 18 19 20 21 22 23 24 25 26 |
# File 'lib/acts_as_taggable_on/tagger.rb', line 16 def acts_as_tagger(opts={}) class_eval do has_many :owned_taggings, opts.merge(:as => :tagger, :dependent => :destroy, :include => :tag, :class_name => "ActsAsTaggableOn::Tagging") has_many :owned_tags, :class_name => "ActsAsTaggableOn::Tag" , :as => :tagger end include ActsAsTaggableOn::Tagger::InstanceMethods extend ActsAsTaggableOn::Tagger::SingletonMethods end |
#is_tagger? ⇒ Boolean
28 29 30 |
# File 'lib/acts_as_taggable_on/tagger.rb', line 28 def is_tagger? false end |