Class: Tag

The Tag model. This model is automatically generated and added to your app if you run the tagging generator included with has_many_polymorphs.

Child modules and classes

Class Tag::Error

Constants

NameValue
DELIMITER " "

Public Instance Methods


before_create ()

Callback to strip extra spaces from the tagname before saving it. If you allow tags to be renamed later, you might want to use the before_save callback instead.

    # File generators/tagging/templates/tag.rb, line 31
31:   def before_create 
32:     self.name = name.downcase.strip.squeeze(" ")
33:   end

to_s ()

Defined on the taggable models, not on Tag itself. Return the tagnames associated with this record as a string.

    # File generators/tagging/templates/tag.rb, line 25
25:       def to_s
26:         self.map(&:name).sort.join(Tag::DELIMITER)
27:       end