title: Ruby-on-Rails JavaScript not loading on link_to
body: <p>I'm using Google visualisation to build a charts table in a script tag nested inside a view. This works well enough when the page is fetched directly but when running through a <code>link_to</code> helper the javascript does not work. </p>
  
  <p>I believe this was related to turbolinks however wrapping the JavaScript as below with a  <code>page:load</code> hasn't made a difference. I have confirmed turning off turbolinks does resolve this however the whole app is significantly slower without it.</p>
  
  <pre><code>&lt;script  type="text/javascript" charset="UTF-8"&gt;
      function resultstable () {
          google.load('visualization', '1', {packages:['table']});
            google.setOnLoadCallback(drawTable);
            function drawTable() {
             var data = new google.visualization.DataTable();
              data.addColumn('string', '');
              data.addColumn('number', 'Lot #');
              data.addColumn('string', 'Client');
              data.addColumn('boolean', 'Commercial');
              data.addColumn('string', 'Site');
              data.addColumn('string', 'Biological Classification');
              data.addColumn('string', 'Actions');
              data.addRows([
                  &lt;% @lots.each do |lot| %&gt;
                      [
                      '&lt;%= check_box_tag "lot_ids[]", lot.id %&gt;', 
                      &lt;%= lot.id.to_s %&gt;, 
                      '&lt;%= link_to Client.find(lot.client_id).org.to_s.humanize, client_path(lot.client_id) %&gt;',
                      &lt;%= lot.commercial %&gt;,
                      '&lt;%= lot.site %&gt;',
                      '&lt;%= lot.phylum.to_s + " " + lot.l_class.to_s + " " + lot.genus.to_s + " " + lot.species.to_s %&gt;',
                      '&lt;%= link_to edit_lot_path(lot) do %&gt;&lt;i class="icon-edit"&gt;&lt;/i&gt;&lt;% end %&gt; &lt;%= link_to lot_path(lot) do %&gt;&lt;i class="icon-time"&gt;&lt;/i&gt;&lt;% end %&gt;'
                      ],
                  &lt;% end %&gt;           
              ]);
  
              function rm_google_classes() {
              var className = 'google-visualization-table-table';
              $('.'+className).removeClass(className);
  
              var className = 'google-visualization-table-th';
              $('.'+className).removeClass(className);
  
              var className = 'google-visualization-table-tr-head';
              $('.'+className).removeClass(className);
  
              var className = 'google-visualization-table-tr-odd';
              $('.'+className).removeClass(className);
  
              var className = 'google-visualization-table-tr-even';
              $('.'+className).removeClass(className); 
  
              var className = 'google-visualization-table-td';
              $('.'+className).removeClass(className);  
  
              var className = 'google-visualization-table-td-number';
              $('.'+className).removeClass(className);  
  
              var className = 'google-visualization-table-td-bool';
              $('.'+className).removeClass(className);  
  
              $("#gtable-results table").addClass("table table-condensed"); 
              };
  
              var table = new google.visualization.Table(document.getElementById('gtable-results'));
                table.draw(data, {allowHtml: true});
                rm_google_classes();
  
              google.visualization.events.addListener(table , 'sort',
              function(event) {
                rm_google_classes();
              });     
             };
           }
  
      $(document).ready(resultstable());
      $(document).on('page:load', resultstable());       
  &lt;/script&gt;
  </code></pre>