Search code examples
ruby-on-railsruby-on-rails-3gmaps4railsgoogle-geocoder

Does gmaps4rails conflict with geocoder gem?


I am using gmaps4rails to easily generate a google map on my app. gmaps4rails requires a lat and long attributes in the model. however, gmaps4rails isn't very friendly with ambiguous addresses. For example, it doesn't know what address to show when I list an apartment number.

So, I just installed geocoder. I am using geocoder to take my :location attribute and set the lat/long of that in my model. It seems to be working right now but since both gems use the lat/long attributes, I am thinking this will cause a conflict later on. Will it?


Solution

  • Both gems shouldn't interfere but be sure to tell gmaps4rails not to try to geocode the saved objects:

    acts_as_gmappable :process_geocoding => false
    

    Otherwise, concerning the ambiguous address, you can get raw results from gmaps4rails doing:

    Gmaps4rails.geocode(address)
    

    Anyway, feel free to use the geocoding library you prefer: gmaps4rails is after all not really made for geocoding but to display maps! (and Geocoder is great for it's job)