title: rails 4 with turbolinks and window load
body: <p>I'm using Rails 4. </p>
  
  <p>I'm trying to use this script to show google maps. I got a page with different places and each place got an address. It shows in google maps.<br>
  So i'm using pagination and on each page I got 4 places. 4 scripts of gmap.<br>
  But this scripts initializes only on page reload (ctrl+R or F5), that's because of turbolinks.  </p>
  
  <p>How can i make it work the easiest way?</p>
  
  <pre><code>&lt;script&gt;
    function initialize() {
      var myLatlng = new google.maps.LatLng(&lt;%= place.latitude %&gt;, &lt;%= place.longitude %&gt;); 
      var mapOptions = {
        zoom: 16,
        center: myLatlng
      };
      var map = new google.maps.Map(
        document.getElementById("map-canvas-&lt;%= place.id %&gt;"),
        mapOptions);
      var marker = new google.maps.Marker({
        position: myLatlng,
        map: map,
        title: '&lt;%= place.title %&gt;'
      });
    }
  
    google.maps.event.addDomListener(window, 'load', initialize);
  &lt;/script&gt;
  </code></pre>
  
  <p>that's the script. And div with each map looks like this:</p>
  
  <pre><code>&lt;div id="map-canvas-&lt;%= place.id %&gt;"&gt;&lt;/div&gt;
  </code></pre>