From 60ee62ed8dd39e78374f93eb96d4a588f4c1af32 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Hannes=20Wu=CC=88thrich?= <hannes.wuethrich@garaio.com> Date: Thu, 1 Dec 2011 12:28:04 +0100 Subject: [PATCH] Swap arguments for BETWEEN in #within_bounding_box Fixes issue #145 --- lib/geocoder/stores/active_record.rb | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/lib/geocoder/stores/active_record.rb b/lib/geocoder/stores/active_record.rb index 4153e6ae..cbbb5914 100644 --- a/lib/geocoder/stores/active_record.rb +++ b/lib/geocoder/stores/active_record.rb @@ -52,7 +52,7 @@ module Geocoder::Store return where(:id => false) unless sw_lat && sw_lng && ne_lat && ne_lng spans = "latitude BETWEEN #{sw_lat} AND #{ne_lat} AND " spans << if sw_lng > ne_lng # Handle a box that spans 180 - "longitude BETWEEN #{sw_lng} AND 180 OR longitude BETWEEN #{ne_lng} and -180" + "longitude BETWEEN #{sw_lng} AND 180 OR longitude BETWEEN -180 AND #{ne_lng}" else "longitude BETWEEN #{sw_lng} AND #{ne_lng}" end -- GitLab