if Rails.env.development?
@current_location_geo = Geocoder.search(request.remote_ip).first
else
@current_location_geo = request.location
end
if !@current_location_geo.nil? && @current_location_geo.ip == "127.0.0.1"
@departure_currency_code= "AUD"
@departure_currency_name= ["Australian Dollar(AUD $)","AUD"]
else
@country = Country.new(request.location.data["country_code"].to_s)
@country_code = @country.currency.code
end
end
Run Code Online (Sandbox Code Playgroud)
我收到了request.location nil.我试图在配置中添加超时但它对我没有帮助.
生产模式中的错误,因为"地理编码API的响应无效JSON".
当我追踪它时,我得到request.location为零.
我的地理编码器版本是(1.2.6).