Module: Cms::Behaviors::Taggable::MacroMethods

Defined in:
lib/cms/behaviors/taggable.rb

Instance Method Summary collapse

Instance Method Details

#is_taggable(options = {}) ⇒ Object



11
12
13
14
15
16
17
18
19
20
21
22
23
24
# File 'lib/cms/behaviors/taggable.rb', line 11

def is_taggable(options={})
  @is_taggable = true
  @tag_separator = options[:separator] || " "
  
  has_many :taggings, :as => :taggable
  has_many :tags, :through => :taggings, :order => "tags.name"                    
  
  named_scope :tagged_with, lambda{|t| {:include => {:taggings => :tag}, :conditions => ["tags.name = ?", t]} }          
            
  after_save :save_tags          
            
  extend ClassMethods
  include InstanceMethods
end

#taggable?Boolean

Returns:

  • (Boolean)


8
9
10
# File 'lib/cms/behaviors/taggable.rb', line 8

def taggable?
  !!@is_taggable
end