2016-12-11 20:02:24 -08:00
|
|
|
# config/initializers/geocoder.rb
|
2016-12-13 22:29:57 -08:00
|
|
|
config = {
|
2016-12-11 20:02:24 -08:00
|
|
|
# geocoding service (see below for supported options):
|
2016-12-13 22:29:57 -08:00
|
|
|
lookup: :google,
|
2016-12-11 20:02:24 -08:00
|
|
|
|
|
|
|
# IP address geocoding service (see below for supported options):
|
2016-12-13 22:29:57 -08:00
|
|
|
ip_lookup: :freegeoip,
|
2016-12-11 20:02:24 -08:00
|
|
|
|
|
|
|
# to use an API key:
|
|
|
|
|
|
|
|
# geocoding service request timeout, in seconds (default 3):
|
2016-12-13 22:29:57 -08:00
|
|
|
timeout: 5,
|
2016-12-11 20:02:24 -08:00
|
|
|
|
|
|
|
# set default units to kilometers:
|
2016-12-13 22:29:57 -08:00
|
|
|
units: :km
|
|
|
|
}
|
2016-12-11 20:02:24 -08:00
|
|
|
|
2016-12-13 22:29:57 -08:00
|
|
|
# use our api key on the server
|
|
|
|
if Rails.env.preview? || Rails.env.production?
|
|
|
|
config[:api_key] = "AIzaSyDurfjX9f_NgYsJLyUuGqwdKuI745CE_OE"
|
|
|
|
config[:use_https] = true
|
|
|
|
end
|
|
|
|
|
|
|
|
Geocoder.configure(config)
|