diff --git a/lib/geocoder/stores/active_record.rb b/lib/geocoder/stores/active_record.rb index 6272551f58cc550648c2c78f77b4d69863351dda..40974b512e0fa95fbbc4e0f688d970b9d85283c6 100644 --- a/lib/geocoder/stores/active_record.rb +++ b/lib/geocoder/stores/active_record.rb @@ -36,7 +36,7 @@ module Geocoder::Store if latitude and longitude near_scope_options(latitude, longitude, *args) else - where(:id => false) # no results if no lat/lon given + where(false_condition) # no results if no lat/lon given end } @@ -244,6 +244,13 @@ module Geocoder::Store def using_sqlite? connection.adapter_name.match /sqlite/i end + + ## + # Value which can be passed to where() to produce no results. + # + def false_condition + using_sqlite? ? 0 : "false" + end end ##