0

こんにちは、Ruby on Rails 3でGeokitプラグインを使用していますが、問題なく動作します。しかし、適切な方法でオリジン値を指定すると、 Geokit :: Geocoders::GeocodeErrorがスローされます。

これが私のコードです:

@listing = Listing.geo_scope(:origin=>"sdfaasssssssdfdfsdfdfdfdfsdfsdfsdfsdfsdf")

エラー:

Geokit::Geocoders::GeocodeError: Geokit::Geocoders::GeocodeError
from C:/Ruby192/lib/ruby/gems/1.9.1/gems/geokit-1.5.0/lib/geokit/mappable.rb:282:in `normalize'
from C:/Ruby192/lib/ruby/gems/1.9.1/gems/geokit-rails3-0.1.2/lib/geokit-rails3/acts_as_mappable.rb:229:in `normalize_point_to_lat_lng'
from C:/Ruby192/lib/ruby/gems/1.9.1/gems/geokit-rails3-0.1.2/lib/geokit-rails3/acts_as_mappable.rb:189:in `extract_origin_from_options'
from C:/Ruby192/lib/ruby/gems/1.9.1/gems/geokit-rails3-0.1.2/lib/geokit-rails3/acts_as_mappable.rb:111:in `geo_scope'
from (irb):3
from C:/Ruby192/lib/ruby/gems/1.9.1/gems/railties-3.0.3/lib/rails/commands/console.rb:44:in `start'
from C:/Ruby192/lib/ruby/gems/1.9.1/gems/railties-3.0.3/lib/rails/commands/console.rb:8:in `start'
from C:/Ruby192/lib/ruby/gems/1.9.1/gems/railties-3.0.3/lib/rails/commands.rb:23:in `<top (required)>'
from D:/ariv/projects/RubyMine/rentstore/script/rails:6:in `require'
from D:/ariv/projects/RubyMine/rentstore/script/rails:6:in `<top (required)>'
from -e:1:in `load'
from -e:1:in `<main>

このエラーを処理する方法は?

ありがとう、

L.アリバラサン

4

1 に答える 1

1

本当の意味はわかりませんが、このようなものが必要なのかもしれません

    begin
        @listing = Listing.geo_scope(:origin=>"sdfaasssssssdfdfsdfdfdfdfsdfsdfsdfsdfsdf")
    rescue Geokit::Geocoders::GeocodeError
        # handle the error here :-)
    end
于 2011-07-28T13:53:19.440 に答える