You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
|
|
|
class CityCache < ActiveRecord::Base
|
|
|
|
self.table_name = :city_cache
|
|
|
|
|
|
|
|
belongs_to :city
|
|
|
|
|
|
|
|
def self.search(str)
|
|
|
|
CityCache.find_by_search(str.downcase)
|
|
|
|
end
|
|
|
|
|
|
|
|
def self.cache(str, city_id)
|
|
|
|
CityCache.create(city_id: city_id, search: str.downcase)
|
|
|
|
end
|
|
|
|
end
|