I\'m using gmaps4rails to load a map on a \"clients\" show page. I\'ve integrated turbolinks to make the app speadier all together, but now I\'m hitting an issue where I hav
You can use the callback directly from the google map URL
<%= gmap_scripts(callback: 'onGmapsInit') %>
And my helper
# helpers/maps_helper.rb
module MapsHelper
GMAPS_V3_URL = 'https://maps.googleapis.com/maps/api/js'
def gmap_scripts(options = {})
callback = options.delete(:callback)
gmaps_v3_options = {
src: "#{GMAPS_V3_URL}?#{callback ? "callback=#{callback}&" : ''}key=&sensor=false"
}
gmaps_utility_options = {
src: '//google-maps-utility-library-v3.googlecode.com/svn/tags/markerclustererplus/2.0.14/src/markerclusterer_packed.js'
}
capture do
concat content_tag(:script, nil, gmaps_v3_options)
concat content_tag(:script, nil, gmaps_utility_options)
end
end
What ? Turbolinks ? Is it something to eat ?
I'm using Turbolinks 5, and as you can see with this code you don't even need a
$(document).on('ready turbolinks:load')