winston/google_visualr — pull request #64 by ghiculescu (2013-11-14 01:30:46+00:00)
Title: Fix: chart loading can fail, and cause the entire page to render as a white screen, when using Turbolinks

This bug comes up when using [Turbolinks](https://github.com/rails/turbolinks). I've been able to replicate it in Chrome 31 and Firefox 24 - though the test harness only works in FF because Turbolinks doesn't run on localhost in Chrome (due to security policy).

I'm not sure exactly why (haven't dove deep enough into Google's code yet), but calling `google.load('visualization','1', {packages: ['corechart']});` without a `callback` is the culprit. The issue comes up when Turbolinks [inserts the script](https://github.com/rails/turbolinks/blob/master/lib/assets/javascripts/turbolinks.js.coffee#L85) and causes the browser to execute it.

My fix is to add a `callback` referring to the given function. This way you're still able to refer to the function by name, without the bug occurring.