Class: ActsAsTaggableOn::Tag

Inherits:
Object
  • Object
show all
Defined in:
app/models/acts_as_taggable_on-tag.rb

Class Method Summary collapse

Class Method Details

.autocomplete(name) ⇒ Object


10
11
12
# File 'app/models/acts_as_taggable_on-tag.rb', line 10

def self.autocomplete(name)
  where("name LIKE ?", "#{name.downcase}%")
end

.normalize(name) ⇒ Object


14
15
16
17
18
19
20
21
# File 'app/models/acts_as_taggable_on-tag.rb', line 14

def self.normalize(name)
  if name =~ /^#?<3/
    # Special case for love, because the world needs more love.
    '<3'
  elsif name
    name.gsub(/[^#{self.tag_text_regexp}]/, '').downcase
  end
end

.tag_text_regexpObject


6
7
8
# File 'app/models/acts_as_taggable_on-tag.rb', line 6

def self.tag_text_regexp
  @@tag_text_regexp ||= "[[:alnum:]]_-"
end