Module: Tagger::ActiveRecord::ClassMethods

Defined in:
lib/tagger/active_record.rb

Instance Method Summary collapse

Instance Method Details

#taggable(options = {}) ⇒ Object



12
13
14
15
16
17
18
19
20
21
22
23
24
# File 'lib/tagger/active_record.rb', line 12

def taggable(options={})
  include InstanceMethods

  self.taggable_options = {
    :separator => options[:separator],
    :scope => options[:scope]
  }

  has_many :taggings, :as => :taggable, :dependent => :destroy
  has_many :tags, :through => :taggings, :order => "tags.name asc"

  after_save :save_tags
end