Module: Geocoder::Request
- Defined in:
- lib/geocoder/request.rb
Instance Method Summary collapse
Instance Method Details
#location ⇒ Object
6 7 8 9 10 11 12 13 14 15 16 17 |
# File 'lib/geocoder/request.rb', line 6 def location unless defined?(@location) if env.has_key?('HTTP_X_REAL_IP') @location = Geocoder.search(env['HTTP_X_REAL_IP']).first elsif env.has_key?('HTTP_X_FORWARDED_FOR') @location = Geocoder.search(env['HTTP_X_FORWARDED_FOR'].split(/\s*,\s*/)[0]).first else @location = Geocoder.search(ip).first end end @location end |