Sha256: 0d92c3d32710ad07c7930c5ea5027e564d4f946c7cfbe55f1b51d861eb69f737
Contents?: true
Size: 582 Bytes
Versions: 4
Compression:
Stored size: 582 Bytes
Contents
# Extends AR to add earthdistance functionality. require "activerecord-postgres-earthdistance/acts_as_geolocated" module ActiveRecord module ConnectionAdapters module SchemaStatements def add_earthdistance_index table_name, options = {} execute "CREATE INDEX %s_earthdistance_ix ON %s USING gist (ll_to_earth(%s, %s));" % [table_name, table_name, (options[:lat] || 'lat'), (options[:lng] || 'lng')] end def remove_earthdistance_index table_name execute "DROP INDEX %s_earthdistance_ix;" % [table_name] end end end end
Version data entries
4 entries across 4 versions & 1 rubygems