Permalink
Browse files

Convert to numbers before comparing.

This fixes issue #260.
  • Loading branch information...
1 parent 19a8c8f commit 8e84780d7464b940c8c6c591ba40b9deea0dfcf1 @alexreisner committed Sep 29, 2012
Showing with 1 addition and 1 deletion.
  1. +1 −1 lib/geocoder/stores/active_record.rb
@@ -56,7 +56,7 @@ def self.included(base)
return select(select_clause(nil, "NULL", "NULL")).where(false_condition)
end
spans = "#{geocoder_options[:latitude]} BETWEEN #{sw_lat} AND #{ne_lat} AND "
- spans << if sw_lng > ne_lng # Handle a box that spans 180
+ spans << if sw_lng.to_f > ne_lng.to_f # handle box that spans 180 longitude
"#{geocoder_options[:longitude]} BETWEEN #{sw_lng} AND 180 OR " +
"#{geocoder_options[:longitude]} BETWEEN -180 AND #{ne_lng}"
else

0 comments on commit 8e84780

Please sign in to comment.