{"action":"closed","issue":{"url":"https://api.github.com/repos/cjheath/geoip/issues/60","repository_url":"https://api.github.com/repos/cjheath/geoip","labels_url":"https://api.github.com/repos/cjheath/geoip/issues/60/labels{/name}","comments_url":"https://api.github.com/repos/cjheath/geoip/issues/60/comments","events_url":"https://api.github.com/repos/cjheath/geoip/issues/60/events","html_url":"https://github.com/cjheath/geoip/issues/60","id":142434096,"number":60,"title":"Very weird bug. Sometime GEO_IP_CITY.city returns incorrect info","user":{"login":"Eastknight","id":9652909,"avatar_url":"https://avatars.githubusercontent.com/u/9652909?v=3","gravatar_id":"","url":"https://api.github.com/users/Eastknight","html_url":"https://github.com/Eastknight","followers_url":"https://api.github.com/users/Eastknight/followers","following_url":"https://api.github.com/users/Eastknight/following{/other_user}","gists_url":"https://api.github.com/users/Eastknight/gists{/gist_id}","starred_url":"https://api.github.com/users/Eastknight/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/Eastknight/subscriptions","organizations_url":"https://api.github.com/users/Eastknight/orgs","repos_url":"https://api.github.com/users/Eastknight/repos","events_url":"https://api.github.com/users/Eastknight/events{/privacy}","received_events_url":"https://api.github.com/users/Eastknight/received_events","type":"User","site_admin":false},"labels":[],"state":"closed","locked":false,"assignee":null,"milestone":null,"comments":1,"created_at":"2016-03-21T18:35:57Z","updated_at":"2016-03-22T01:40:09Z","closed_at":"2016-03-22T01:40:09Z","body":"I've been using this gem for a long time. It worked just fine until recently I found a very weird bug when I try to track requests from Africa to my website.\r\n\r\nMy ruby code is like this:\r\n```\r\n# In class ApplicationController < ActionController::Base\r\n\r\nafter_filter :monitor_african_requests\r\n\r\ndef monitor_african_requests\r\n    request_ip = request.ip\r\n    geo_city = GEO_IP_CITY.city(request_ip)\r\n    user = current_user\r\n    condition = user && geo_city.is_a?(GeoIP::City) && geo_city.continent_code == 'AF'\r\n    if condition\r\n      log = \"LOG for African Request: geo_city: #{geo_city.inspect}; IP: #{request_ip.inspect}\"\r\n      Rails.logger.info log\r\n    end\r\nend\r\n```\r\n\r\nThis works for some request but can not find the correct location info for some other requests. For example, this is one of the output in my log file:\r\n\r\n```\r\nLOG for African Request: geo_city: #<struct GeoIP::City request=\"135.0.174.69\", ip=\"135.0.174.69\", country_code2=\"DZ\", country_code3=\"DZA\", country_name=\"Algeria\", continent_code=\"AF\", region_name=\"09\", city_name=\"Oran\", postal_code=\"\", latitude=35.6911, longitude=-0.641699999999986, dma_code=nil, area_code=nil, timezone=\"Africa/Algiers\">; IP: \"135.0.174.69\"\r\n```\r\n\r\nIt shows this request is from Africa, but in my Rails console, I tried the same code, it turned out to be a Canadian IP. \r\n\r\n```\r\nGEO_IP_CITY.city(\"135.0.174.69\")\r\n=> #<struct GeoIP::City request=\"135.0.174.69\", ip=\"135.0.174.69\", country_code2=\"CA\", country_code3=\"CAN\", country_name=\"Canada\", continent_code=\"NA\", region_name=\"ON\", city_name=\"Toronto\", postal_code=\"M2J\", latitude=43.7685, longitude=-79.3584, dma_code=nil, area_code=nil, timezone=\"America/Rainy_River\">\r\n```\r\n\r\nAny idea why this could happen? I'll appreciate any help.\r\n\r\nMy Rails version is 2.3.18 and the geoip version is \"~> 4.0.1\"."}}