Module: SimplyTaggable::Base::ClassMethods

Defined in:
lib/simply_taggable/base.rb

Instance Method Summary collapse

Instance Method Details

#simply_taggableObject



16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
# File 'lib/simply_taggable/base.rb', line 16

def simply_taggable

# add some options like :by => :user 
# in case User isn't the model of choice

  include SimplyTaggable::Base::InstanceMethods

  has_many :taggings, 
    :as => :taggable, 
    :dependent => :destroy

  has_many :tags, 
    :through => :taggings

  attr_writer :tag_names
  attr_accessible :tag_names
  after_save :assign_tags

end

#simply_taggable_taggerObject



8
9
10
11
12
13
14
# File 'lib/simply_taggable/base.rb', line 8

def simply_taggable_tagger
  
  has_many :tags, 
    :as => :tagger, 
    :dependent => :destroy

end