diff --git a/lib/activerecord-postgres-earthdistance/acts_as_geolocated.rb b/lib/activerecord-postgres-earthdistance/acts_as_geolocated.rb index ebfd2c4..fd1dac9 100644 --- a/lib/activerecord-postgres-earthdistance/acts_as_geolocated.rb +++ b/lib/activerecord-postgres-earthdistance/acts_as_geolocated.rb @@ -2,7 +2,6 @@ module ActiveRecordPostgresEarthdistance MILES_TO_METERS_FACTOR = 1609.344 module ActsAsGeolocated extend ActiveSupport::Concern - module ClassMethods def acts_as_geolocated(options = {}) @@ -95,7 +94,7 @@ def self.quote_value(value) module QueryMethods def selecting_distance_from(lat, lng, name = "distance", include_default_columns = true) clone.tap do |relation| - relation.joins!(through_table) + relation.joins!(through_table) if through_table values = [] if relation.select_values.empty? && include_default_columns values << relation.arel_table[Arel.star]