简体   繁体   English

Rails 2.3.4 Geokit错误?

[英]Rails 2.3.4 Geokit error?

I have a rails application. 我有一个Rails应用程序。 Rails version is 2.3.4 and ruby version 1.8.7 . Rails version is 2.3.4ruby version 1.8.7 In that application I used geokit (1.5.0) gem and geokit-rail s plugin to find nearest location. 在该应用程序中,我使用了geokit (1.5.0) gemgeokit-rail的插件来查找最近的位置。

And in my model I have code like this, 在我的模型中,我有这样的代码,

class Notary < ActiveRecord::Base

acts_as_mappable

end

And in my controller have code like this, 在我的控制器中有这样的代码,

class Client::OrdersController < ApplicationController

    def find_notary
    @order = Order.find(params[:id])
    @miles = 10
    unless params[:notary_search]
      @notaries = Notary.find(:all, :origin => @order.signing_location_zip_code, :within => @miles, :conditions => "on_vacation IS NOT true",:order=>"distance asc" )
    else
    some code
    end
end

end

I am getting error in that line 我在那一行中出错

@notaries = Notary.find(:all, :origin => @order.signing_location_zip_code, :within => @miles, :conditions => "on_vacation IS NOT true",:order=>"distance asc") like this, @notaries = Notary.find(:all,:origin => @ order.signing_location_zip_code,:within => @miles,:conditions =>“ on_vacation不正确”,:order =>“距离asc”),

Geokit::Geocoders::GeocodeError in Client/ordersController#find_notary 客户端/订单中的Geokit :: Geocoders :: GeocodeErrorController#find_notary

Geokit::Geocoders::GeocodeError Geokit :: Geocoders :: GeocodeError

RAILS_ROOT: /home/user/svnnew_app/trunk/app RAILS_ROOT:/ home / user / svnnew_app / trunk / app

Application Trace | 应用程序跟踪| Framework Trace | 框架跟踪 Full Trace 全迹

/home/user/.rvm/gems/ruby-1.8.7-p371@app/gems/geokit-1.5.0/lib/geokit/mappable.rb:282:in `normalize' /home/user/.rvm/gems/ruby-1.8.7-p371@app/gems/geokit-1.5.0/lib/geokit/mappable.rb:282:在“规范化”中

/home/user/svnnew_app/trunk/app/vendor/plugins/geokit-rails/lib/geokit-rails/acts_as_mappable.rb:347:in `normalize_point_to_lat_lng' /home/user/svnnew_app/trunk/app/vendor/plugins/geokit-rails/lib/geokit-rails/acts_as_mappable.rb:347:in normalize_point_to_lat_lng

/home/user/svnnew_app/trunk/app/vendor/plugins/geokit-rails/lib/geokit-rails/acts_as_mappable.rb:306:in `extract_origin_from_options' /home/user/svnnew_app/trunk/app/vendor/plugins/geokit-rails/lib/geokit-rails/acts_as_mappable.rb:306:在`extract_origin_from_options'中

/home/user/svnnew_app/trunk/app/vendor/plugins/geokit-rails/lib/geokit-rails/acts_as_mappable.rb:203:in `prepare_for_find_or_count' /home/user/svnnew_app/trunk/app/vendor/plugins/geokit-rails/lib/geokit-rails/acts_as_mappable.rb:203:在`prepare_for_find_or_count'中

/home/user/svnnew_app/trunk/app/vendor/plugins/geokit-rails/lib/geokit-rails/acts_as_mappable.rb:108:in `find' /home/user/svnnew_app/trunk/app/vendor/plugins/geokit-rails/lib/geokit-rails/acts_as_mappable.rb:108:在“查找”中

/home/user/svnnew_app/trunk/app/app/controllers/client/orders_controller.rb:331:in `find_notary' /home/user/svnnew_app/trunk/app/app/controllers/client/orders_controller.rb:331:in'find_notary'

Request 请求

Parameters: 参数:

{"id"=>"1198"} {“ id” =>“ 1198”}

Show session dump Response 显示会话转储响应

Headers: 标头:

{"Cache-Control"=>"no-cache", "Content-Type"=>""} {“ Cache-Control” =>“ no-cache”,“ Content-Type” =>“”}

How to resolve this error? 如何解决这个错误? Please help me out.. 请帮帮我..

I maintain geokit. 我维护geokit。 I had a look at the source code and that line happens when the response back from the API isn't numeric, eg a string but not in the format '99.99, 88.88', so would happen if the geocoding API returned 'NA' or something for example. 我看了一下源代码,当从API返回的响应不是数字(例如,字符串,但格式不是“ 99.99,88.88”)时,就会发生该行,因此如果地理编码API返回“ NA”或例如。

And I know StackOverflow says "avoid" the following (clarification, opinion, etc.), but here it is: 而且我知道StackOverflow会说“避免”以下内容(澄清,意见等),但是在这里是:

I can't help further without you doing a few things: 如果您不做一些事情,我无能为力:

1) If you could update to the latest geokit (gem: 1.7.1 or the latest github master) 1)如果您可以更新到最新的geokit(gem:1.7.1或最新的github master)

2) Do some debugging, eg Open "/home/user/.rvm/gems/ruby-1.8.7-p371@app/gems/geokit-1.5.0/lib/geokit/mappable.rb" (line 282) and least "puts" the string that is causing the error along with any other relevant local variables. 2)做一些调试,例如打开“ /home/user/.rvm/gems/ruby-1.8.7-p371@app/gems/geokit-1.5.0/lib/geokit/mappable.rb”(282行),然后至少将引起错误的字符串与任何其他相关的局部变量“放入”。

Using gems like pry/pry-debugger are a must for any ruby developer to debugging such issues. 对于任何红宝石开发人员而言,必须使用诸如pry / pry-debugger之类的宝石来调试此类问题。

3) Update other software where possible (even upgrade to latest ruby 1.8.7 and rails 2.x) You're ruby (1.8.7) and rails (2.x) both are quite old and contain various security issues which should be of some concern. 3)在可能的情况下更新其他软件(甚至升级到最新的ruby 1.8.7和rails 2.x)您的ruby(1.8.7)和rails(2.x)都很老,并且包含各种安全问题,应该有些关注。 I do my best to keep geokit/geokit-rails working with ruby 1.8.7, but even rails 2 compatibility was dropped in geokit-rails, although I'm happy to help because likely you issue is a problem in geokit-rails with supported rails versions. 我尽我所能使geokit / geokit-rails与ruby 1.8.7一起工作,但是geokit-rails中甚至降低了rails 2的兼容性,尽管我很乐意为您提供帮助,因为您可能会在支持的geokit-rails中遇到问题导轨版本。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM