Module: Cms::Taggable

Included in:
Asset
Defined in:
app/models/cms/taggable.rb

Defined Under Namespace

Modules: TaggableMethods Classes: TagList

Class Method Summary collapse

Class Method Details

.included(klass) ⇒ Object



13
14
15
16
17
18
19
20
21
22
23
24
# File 'app/models/cms/taggable.rb', line 13

def self.included(klass)
  klass.extend TaggableMethods::ClassMethods

  klass.class_eval do
    include TaggableMethods::InstanceMethods

    has_many :taggings, :as => :taggable, :dependent => :destroy, :class_name => 'Cms::Tagging'
    has_many :tags, :through => :taggings

    after_save :save_tags
  end
end