blob: ca38de75174e7f656d147df759fe11f68c5177f7 (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
|
module ActsAsTaggableOn
class Tag
self.include_root_in_json = false
def self.tag_text_regexp
@@tag_text_regexp ||= "[[:alnum:]]_-"
end
def self.autocomplete(name)
where("name LIKE ?", "#{name.downcase}%").order("name ASC")
end
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
end
end
|