作者热门文章
- html - 出于某种原因,IE8 对我的 Sass 文件中继承的 html5 CSS 不友好?
- JMeter 在响应断言中使用 span 标签的问题
- html - 在 :hover and :active? 上具有不同效果的 CSS 动画
- html - 相对于居中的 html 内容固定的 CSS 重复背景?
嗨,我在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>
最佳答案
我不知道你的意思,但也许你想要这样的东西
begin
@listing = Listing.geo_scope(:origin=>"sdfaasssssssdfdfsdfdfdfdfsdfsdfsdfsdfsdf")
rescue Geokit::Geocoders::GeocodeError
# handle the error here :-)
end
关于ruby-on-rails-3 - 如何处理Geokit::Geocoders::GeocodeError in rails 3,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/6856807/
嗨,我在Ruby on Rails 3中使用Geokit插件,对我来说很好用。但是,当我以不正确的方式给出原点值时,它将抛出 Geokit::Geocoders::GeocodeError 这是我的代
我是一名优秀的程序员,十分优秀!