title: Rails and Highcharts
body: <p>I'm trying to generate a column graph via highcharts using rails.</p>
  
  <p>I have placed the highcharts.js file in the javascript folder and have created my corresponding trials.js file:</p>
  
  <pre><code>$(function () {
      new Highcharts.Chart({
        chart: { type: 'column', 
                               renderTo: 'trials_chart' },
              title: { text: '' },
              xAxis: { type: 'datetime' },
                  yAxis: {
                    title: { text: 'Yield (bales/ha)'}
                  },
                  series: [{
                  name: "",
                    data: [&lt;% @result.each do |d| %&gt;
                                  &lt;%= "%.2f" % (d.lint/227) %&gt;
                                &lt;% end %&gt;
                          ]
                                  }]
                });
              });
  </code></pre>
  
  <p>Where the data value is i'm trying to pass a loop which isn't working. When i input variables eg. [1,2,3,4,5] it works, but it can't generate and erb requests for some reason. The loop also features in my view to display a table with the data and works fine:</p>
  
  <p>Trials view</p>
  
  <pre><code>&lt;table class="table"&gt;
  &lt;% @result.each do |r| %&gt;
  &lt;tr&gt;
  &lt;td&gt;&lt;%= r.variety.variety_name %&gt;&lt;/td&gt;
  &lt;td&gt;&lt;%= "%.2f" % (r.lint/227) %&gt;&lt;/td&gt;
  &lt;/tr&gt;
  &lt;% end %&gt;
  &lt;/table&gt;
  </code></pre>
  
  <p>My Controller (Trial)</p>
  
  <pre><code>def trial
      @result = Result.where('trial_id' =&gt; params[:trial_id]).order('lint DESC')
  end
  </code></pre>