Smarter city search caching
This commit is contained in:
parent
80000057a6
commit
02e349261c
@ -14,7 +14,7 @@ class CityCache < ActiveRecord::Base
|
|||||||
end
|
end
|
||||||
|
|
||||||
private
|
private
|
||||||
def normalize_string(str)
|
def self.normalize_string(str)
|
||||||
# remove accents, unnecessary whitespace, punctuation, and lowcase tje string
|
# remove accents, unnecessary whitespace, punctuation, and lowcase tje string
|
||||||
I18n.transliterate(str).gsub(/[^\w\s]/, '').gsub(/\s\s+/, ' ').strip.downcase
|
I18n.transliterate(str).gsub(/[^\w\s]/, '').gsub(/\s\s+/, ' ').strip.downcase
|
||||||
end
|
end
|
||||||
|
Loading…
x
Reference in New Issue
Block a user