From 122278e9873a5dcc916f4fd885beec5229435d25 Mon Sep 17 00:00:00 2001 From: Isaiah Peng Date: Wed, 18 Apr 2018 17:40:01 +0200 Subject: [PATCH] replace table_exists? with data_source_exists? --- lib/activerecord-postgres-earthdistance/acts_as_geolocated.rb | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/lib/activerecord-postgres-earthdistance/acts_as_geolocated.rb b/lib/activerecord-postgres-earthdistance/acts_as_geolocated.rb index 7bedd99..37051f4 100644 --- a/lib/activerecord-postgres-earthdistance/acts_as_geolocated.rb +++ b/lib/activerecord-postgres-earthdistance/acts_as_geolocated.rb @@ -5,7 +5,7 @@ module ActsAsGeolocated module ClassMethods MILES_TO_METERS_FACTOR = 1609.344 def acts_as_geolocated(options = {}) - if table_exists? + if ActiveRecord::Base.connection.data_source_exists?(table_name) cattr_accessor :latitude_column, :longitude_column, :through_table, :distance_unit self.latitude_column = options[:lat] || (column_names.include?("lat") ? "lat" : "latitude") self.longitude_column = options[:lng] ||