diff --git a/lib/geocoder/lookups/maxmind_local.rb b/lib/geocoder/lookups/maxmind_local.rb index 8fcea68a48604f7f87794ab57f416b3fd997d099..0fa5d8673cc7b9fd121765f119bf2368f849c9c5 100644 --- a/lib/geocoder/lookups/maxmind_local.rb +++ b/lib/geocoder/lookups/maxmind_local.rb @@ -42,7 +42,7 @@ module Geocoder::Lookup addr = IPAddr.new(query.text).to_i q = "SELECT country, country_code FROM maxmind_geolite_country WHERE start_ip_num <= #{addr} AND #{addr} <= end_ip_num" - format_result(q, [:country_name, :country_code]) + format_result(q, [:country_name, :country_code2]) end end diff --git a/lib/geocoder/results/maxmind_local.rb b/lib/geocoder/results/maxmind_local.rb index 6f3f9c4354599c9c1ffb174eeeb90fb683c45b5d..81b545ab43d1d10986ab1c23e04fe6d4c6d6124b 100644 --- a/lib/geocoder/results/maxmind_local.rb +++ b/lib/geocoder/results/maxmind_local.rb @@ -29,7 +29,7 @@ module Geocoder::Result end def country_code - @data[:country_code] + @data[:country_code2] end def postal_code diff --git a/test/unit/lookups/maxmind_local_test.rb b/test/unit/lookups/maxmind_local_test.rb index 751fd92b8d6c603bf52f70e3f8d5eb003fe70f77..630eb1f98ab368307c22bd32c996bb53cc95f3de 100644 --- a/test/unit/lookups/maxmind_local_test.rb +++ b/test/unit/lookups/maxmind_local_test.rb @@ -14,7 +14,7 @@ class MaxmindLocalTest < GeocoderTestCase assert_equal 'Mountain View', result.city assert_equal 'CA', result.state assert_equal 'United States', result.country - assert_equal 'USA', result.country_code + assert_equal 'US', result.country_code assert_equal '94043', result.postal_code assert_equal 37.41919999999999, result.latitude assert_equal -122.0574, result.longitude