This is an old question using the old version of Gmaps 4 Rails, however anyone who is interested in working with both libs in their latest versions, here's how to do it.
This example is based on sample documentation code.
handler = Gmaps.build('Google'); handler.buildMap({ provider: {}, internal: {id: 'map'}}, function(){ markers = handler.addMarkers([ { "lat": 0, "lng": 0, "picture": { "url": "https://addons.cdn.mozilla.net/img/uploads/addon_icons/13/13028-64.png", "width": 36, "height": 36 }, "infowindow": "hello!" } ]); handler.bounds.extendWith(markers); handler.fitMapToBounds();
Itβs important here to move on to our own Google objects that Gmaps4Rails wraps inside its classes.
If you need click events on your markers, add one handler to oms , as explained in the document .
source share