I have copied the helper into lib, edited application helper to reference them, and copied the javascript files. I haven’t used builders before so I can’t see why the variable Is not being passed correctly.
My code is also shown below, do you have any advice?
**************
Error message
undefined local variable or method `arr_data' for #<ActionView::Base:0x217ddcc> Extracted source (around line #8): 5: #itself an array with first element as label and second element as value 6: xml = Builder::XmlMarkup.new 7: xml.chart(:caption=>'Sales by Product', :numberPrefix=>'$', :formatNumberScale=>'0') do 8: for item in arr_data 9: xml.set(:label=>item[0], :value=>item[1]) 10: end 11: end
****************
Dashboard Controller
def project
headers["content-type"]="text/html"
@arr_data = []
@arr_data << ['Product A','567500']
@arr_data << ['Product B','815300']
@arr_data << ['Product C','556800']
@arr_data << ['Product D','734500']
@arr_data << ['Product E','676800']
@arr_data << ['Product F','648500']
end
View
# The xml is obtained as a string from builder template.
str_xml = render :file=>"dashboard/project", :locals=>{:arr_data => @arr_data}
#Create the chart - Column 3D Chart with data contained in str_xml
render_chart '/FusionCharts/Column3D.swf', '', str_xml, 'productSales', 600, 300, false, false do-%>
<% end -%>
Any help would be most grateful











