开发者

Two address in the model

I have a model with two address in it.开发者_Go百科 It's possible to use gmaps4rails to geocode the two address ? How can I configure it ?

Thanks


It's definitely possible:

  • configure a standard one

  • use the following in a before_save:

    Gmaps4rails.geocode(second_address)

Reference here: https://github.com/apneadiving/Google-Maps-for-Rails/wiki/Methods


I highly recommend using Ruby Geocoder for this job! Why?

  1. It has multiple backends built-in.
  2. Integrates very well into Rails.
  3. Provides great methods like nearbys or distance_to.
  4. Has a great RailsCast about it.
  5. And no, I'm not advertising it - I'm only a happy user ;)
0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜