diff --git a/lib/geocoder/stores/active_record.rb b/lib/geocoder/stores/active_record.rb index 4153e6ae461df1a1e88c78be1549f0d5cc383e56..cbbb5914296a60ebc64f968c046920fa394369fc 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