Browse Source

Smarter city search caching

development
Godwin 8 years ago
committed by GitHub
parent
commit
02e349261c
  1. 2
      app/models/city_cache.rb

2
app/models/city_cache.rb

@ -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…
Cancel
Save