ruby on rails - Geocoder Gem not working in Production Environment -


so using geocoder pull in latitude , longitude coordinates based on address provided user when submitting form. doing can plot markers using google maps api. works in development - 0 issues. when push production however, latitude , longitude not generated geocoder. have checked production logs , there 0 errors. checked make sure gem not installed development , have restarted unicorn , nginx on production machine. ideas going on?

here model code model preforming task in --

class order < activerecord::base    attr_accessible :city, :customer_email, :customer_id, :delivery_date, :delivery_time, :street, :zipcode, :coupon, :total, :name, :items_with_day, :user_id, :shopping_cart_id, :extras, :latitude, :longitude, :location_name, :phone, :suite, :state    belongs_to :user    validates :name, :presence => true   validates :street, :presence => true   validates :city, :presence => true   validates :zipcode, :presence => true    def address     [street, city, state, "united states"].compact.join(', ')   end    geocoded_by :address   after_validation :geocode  end 

============ update =============

so after suggestion, opened rails console on production machine using --

bundle exec rails console production 

and ran --

geocoder.search("san francisco, ca") 

which generated error --

geocoding api not responding fast enough (use geocoder.configure(:timeout => ...) set limit). => [] 

that being said, in config/initilizers/geocoder.rb file, have --

geocoder::configuration.timeout = 15 

what appropriate timeout limit set? need coordinates, don't want let run forever...

=========== update =============

i found related question, though prefer run task server side, instead of on client side.

the author of geocoder gem has this say:

[a]re sure app server restarted since added geocoder?

first, verify gem indeed installed issuing geocoder command in production console:

# production console geocoder.search("san francisco, ca") 

if not throw errors, try restarting server. soft boot might work – hard boot better. reload entire rails environment, inclusive of installed dependencies.

update:

as mentioned in comments answer, problem related geocoding api not responding fast enough error.

how long appropriate timeout?

that's hard say. gem's author suggests 15, have set to. geocoding service may momentarily slow – or may slow overall. imo, set incrementally higher , find number starts working – leave there.

note client-side vs. server-side argument may not apply here. post cited in op's question relates request quotas. problem being witnessed in question, in contrast, seems relate geocoding speed, not affected whether calls made client or server.


Comments

Popular posts from this blog

php - regexp cyrillic filename not matches -

c# - OpenXML hanging while writing elements -

sql - Select Query has unexpected multiple records (MS Access) -