title: Pass data from Controller to Javascript in Rails
body: <p>I am trying to use <a href="https://developers.google.com/chart/" rel="nofollow">Google Charts API</a> following this example <a href="https://google-developers.appspot.com/chart/interactive/docs/quick_start" rel="nofollow">Google Charts Quick Start</a></p>
  
  <p>As you see the data is created in the JS as:</p>
  
  <pre><code>data.addColumn('string', 'Topping');
          data.addColumn('number', 'Slices');
          data.addRows([
            ['Mushrooms', 3],
            ['Onions', 1],
            ['Olives', 1],
            ['Zucchini', 1],
            ['Pepperoni', 2]
          ]);
  </code></pre>
  
  <p>My question is:</p>
  
  <p>If in my controller I get data... How can I pass it to the Javascript of my template file? I have this example JS hooked up in the head of my index.html.erb file.</p>