geokit / geokit-rails

Official Geokit plugin for Rails/ActiveRecord. Provides location-based goodness for your Rails app. Requires the Geokit gem.
MIT License
1.57k stars 245 forks source link

No initializer created, defaults to miles despite specifying it in acts_as_mappable #45

Closed emilevictor closed 11 years ago

emilevictor commented 11 years ago

I'm specifying kms as my unit as per the instructions, as below:

class Airport < ActiveRecord::Base
  attr_accessible :IATA_code, :ICAO_code, :name, :latitude, :longitude,
                  :city, :altitude_feet, :timezone_offset, :daylight_savings_time,
                  :openflight_airport_id

    acts_as_mappable :default_units => :kms,
                  :units => :kms,
                  :default_formula => :sphere,
                  :distance_field_name => :distance,
                  :lat_column_name => :latitude,
                  :lng_column_name => :longitude

end

But every distance_to calculation that I make on airport instances returns the distance in miles. There is no initialiser file, as installing the gem didn't put one in the right place.

emilevictor commented 11 years ago

This can be closed. Steps for resolution:

  1. Create a geokit_config.rb in /config/initializers
  2. Copy the following template into it: https://raw.github.com/amolpujari/locatable/master/config/geokit_config.rb
  3. Remove the line: Geokit::Geocoders::timeout = 3
  4. Restart server