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
As can be found in this Github issue, you can include google scripts to all your pages. That fixes the issue with Turbolinks not executing gmaps4rails javascripts for newly navigated pages.
Note that gmaps4rails gem has javascript dependencies, namely:
You can add them to all your pages typically by editing app/views/layouts/application.html.erb
.
application.html.erb
....
...
<%= javascript_include_tag 'application', 'data-turbolinks-track' => true %>
<%= csrf_meta_tags %>
# insert the following two lines
...
Also, don't forget to add the source code to your asset pipeline by editing app/assets/javascripts/application.js
application.js
Add this:
//= require gmaps/google
Now, the map should be loading without you having to refresh the page.