diff --git a/lib/geocoder/stores/active_record.rb b/lib/geocoder/stores/active_record.rb
index 3d96012c8fc38c6e4fcdf0897c2e6c61edd88c0f..809c5505f914951c7a0a55feb81a8a65fcb09624 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