Permalink
Browse files

Merge pull request #234 from potomak/master

Fix "Mysql2::Error: Unknown column 'NaN' in 'where clause'" error
  • Loading branch information...
2 parents 56a3bf1 + e112624 commit 4e9247031fff370c9d68fa574d37fc68521c4635 @alexreisner committed May 15, 2012
Showing with 1 addition and 1 deletion.
  1. +1 −1 lib/geocoder/stores/active_record.rb
@@ -33,7 +33,7 @@ def self.included(base)
#
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

0 comments on commit 4e92470

Please sign in to comment.