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

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

Instance Method Summary collapse

Instance Method Details

#is_taggable(options = {}) ⇒ Object



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

def is_taggable(options={})
  @is_taggable = true
  @tag_separator = options[:separator] || " "

  has_many :taggings, :as => :taggable, :class_name => 'Cms::Tagging'
  has_many :tags, -> { order("#{Cms::Tag.table_name}.name") }, :class_name => 'Cms::Tag', :through => :taggings


  after_save :save_tags

  extend ClassMethods
  include InstanceMethods

end

#taggable?Boolean

Returns:

  • (Boolean)


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

def taggable?
  !!@is_taggable
end