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?
- It has multiple backends built-in.
- Integrates very well into Rails.
- Provides great methods like
nearbys
ordistance_to
. - Has a great RailsCast about it.
- And no, I'm not advertising it - I'm only a happy user ;)
精彩评论