当我在浏览器中加载我的操作CarsController#show
时,我收到以下错误消息:
Timeout::Error in CarsController#show
execution expired
并指出这一行的错误:
country = GeoIp.geolocation(ip, :precision => :country)
整个动作:
def show
@car = Item.find_by_car_key(params[:car_key])
ip = request.remote_ip
geo_key = 'my geo key'
GeoIp.api_key = geo_key
country = GeoIp.geolocation(ip, :precision => :country)
puts country.inspect
respond_to do |format|
format.html # show.html.erb
format.json { render json: @item }
end
end
如何避免此错误消息并在加载此操作时始终使用它?
谢谢