Update geokit to version 1.8.3

This commit is contained in:
Erik Michaels-Ober 2013-12-31 19:51:53 +01:00
parent 4241cc754f
commit cd7d63794b
4 changed files with 7 additions and 4 deletions

View File

@ -58,7 +58,7 @@ GEM
fastercsv (1.5.5) fastercsv (1.5.5)
font-awesome-rails (4.0.3.0) font-awesome-rails (4.0.3.0)
railties (>= 3.2, < 5.0) railties (>= 3.2, < 5.0)
geokit (1.7.1) geokit (1.8.3)
multi_json (>= 1.3.2) multi_json (>= 1.3.2)
haml (4.0.4) haml (4.0.4)
tilt tilt

View File

@ -1,6 +1,7 @@
require 'geokit'
class Thing < ActiveRecord::Base class Thing < ActiveRecord::Base
include ActiveModel::ForbiddenAttributesProtection include ActiveModel::ForbiddenAttributesProtection
include Geokit::Geocoders
validates_uniqueness_of :city_id, :allow_nil => true validates_uniqueness_of :city_id, :allow_nil => true
validates_presence_of :lat, :lng validates_presence_of :lat, :lng
belongs_to :user belongs_to :user
@ -17,7 +18,7 @@ class Thing < ActiveRecord::Base
end end
def reverse_geocode def reverse_geocode
@reverse_geocode ||= MultiGeocoder.reverse_geocode([lat, lng]) @reverse_geocode ||= Geokit::Geocoders::MultiGeocoder.reverse_geocode([lat, lng])
end end
def street_number def street_number

View File

@ -1 +0,0 @@
Geokit::Geocoders::provider_order = [:google3]

View File

@ -13,6 +13,9 @@ class AddressesControllerTest < ActionController::TestCase
stub_request(:get, "http://maps.google.com/maps/api/geocode/json"). stub_request(:get, "http://maps.google.com/maps/api/geocode/json").
with(:query => {:address => ", ", :sensor => "false"}). with(:query => {:address => ", ", :sensor => "false"}).
to_return(:body => File.read(File.expand_path('../../fixtures/unknown_address.json', __FILE__))) to_return(:body => File.read(File.expand_path('../../fixtures/unknown_address.json', __FILE__)))
stub_request(:get, "http://geocoder.us/service/csv/geocode").
with(:query => {:address => ", "}).
to_return(:body => File.read(File.expand_path('../../fixtures/unknown_address.json', __FILE__)))
get :show, :address => '', :city_state => '', :format => 'json' get :show, :address => '', :city_state => '', :format => 'json'
assert_response :missing assert_response :missing
end end