diff options
author | Ian Chard <ian@mysociety.org> | 2014-11-04 15:18:58 +0000 |
---|---|---|
committer | Louise Crow <louise.crow@gmail.com> | 2014-11-17 18:36:58 +0000 |
commit | 06f32d5b8c552295cd9ea0636b8e0b9258fbb851 (patch) | |
tree | ab33bec185f0492c3df8b715395f17ef7871fd9e | |
parent | 355bb967c5c844ea29fde03112dc61b5df93caf1 (diff) |
Always try Gaze if the geoip database can't be used
-rw-r--r-- | app/controllers/application_controller.rb | 6 |
1 files changed, 2 insertions, 4 deletions
diff --git a/app/controllers/application_controller.rb b/app/controllers/application_controller.rb index 0b98340fa..afc9bfbc3 100644 --- a/app/controllers/application_controller.rb +++ b/app/controllers/application_controller.rb @@ -424,10 +424,8 @@ class ApplicationController < ActionController::Base def country_from_ip country = "" - if !AlaveteliConfiguration::geoip_database.empty? - if File.file?(AlaveteliConfiguration::geoip_database) - country = GeoIP.new(AlaveteliConfiguration::geoip_database).country(request.remote_ip).country_code2 - end + if File.file?(AlaveteliConfiguration::geoip_database) + country = GeoIP.new(AlaveteliConfiguration::geoip_database).country(request.remote_ip).country_code2 elsif !AlaveteliConfiguration::gaze_url.empty? begin country = quietly_try_to_open("#{AlaveteliConfiguration::gaze_url}/gaze-rest?f=get_country_from_ip;ip=#{request.remote_ip}") |