From e112624ed91652b9eea941e3e7916191f320b78d Mon Sep 17 00:00:00 2001
From: Giovanni Cappellotto <potomak84@gmail.com>
Date: Tue, 15 May 2012 17:32:09 +0200
Subject: [PATCH] Fix "Mysql2::Error: Unknown column 'NaN' in 'where clause'"
 error

---
 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 3d96012c..809c5505 100644
--- a/lib/geocoder/stores/active_record.rb
+++ b/lib/geocoder/stores/active_record.rb
@@ -33,7 +33,7 @@ module Geocoder::Store
         #
         scope :near, lambda{ |location, *args|
           latitude, longitude = Geocoder::Calculations.extract_coordinates(location)
-          if latitude and longitude
+          if latitude and longitude and ![latitude, longitude].include?(Geocoder::Calculations::NAN)
             near_scope_options(latitude, longitude, *args)
           else
             where(false_condition) # no results if no lat/lon given
-- 
GitLab