Search code examples
ruby-on-railsgoogle-mapsmapsgmaps4rails

Google-Maps-for-Rails click map to create new marker


I need to add google map on the create place action. One of the steps is to selected the place location manually by clicking on the map and then get the lng|lat.

I am using Google-Maps-for-Rails and I am happy with it. Is there a way to do this using Google-Maps-for-Rails gem?

If no can you suggest another solution?


Solution

  • Months back I got this working. You can refer to the Google Maps API and there are samples of code. This should give you a head start:

    https://developers.google.com/maps/documentation/javascript/events#EventArguments

    In my Rails app, I didn't use any gem, but just the Google Maps API. That should work just fine. In fact, try not to use any third-party plugin, because the Google Maps API itself is very dynamic.