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


12
13
14
# File 'app/models/acts_as_taggable_on-tag.rb', line 12

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

.normalize(name) ⇒ Object


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

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


8
9
10
# File 'app/models/acts_as_taggable_on-tag.rb', line 8

def self.tag_text_regexp
  @tag_text_regexp ||= "[[:word:]]\u055b\u055c\u055e\u058a_-"
end