I am using a flash chart library that takes an xml file/string as input. The xml file is generated using a xml.builder file, but I am not sure the generated xml file is actually being found.
If there is a (name).xml.builder file and a (name).html.erb file, does that mean both an html/xml file is generated, when format.html and format.xml is called? What could be the other problem?
The relevant code snippets are below: (input_by_month.html.erb)
<script type="text/javascript" language="javascript" src="/javascripts/AnyChart.js"></script>
</head>
<body>
<h2>Input by Month</h2>
<script type="text/javascript" language="javascript">
//<![CDATA[
var chart = new AnyChart('/AnyChart.swf');
chart.setXMLFile('input_by_month.xml');
chart.write();
//]]>
</script>
</body>
The above javascript expects an XML file named "input_by_month.xml". I THINK the file is being built via "input_by_month.xml.builder". XML is well formed and does not contain any errors.
xml.anychart
xml.settings do
....
end
end
The html view is generated in a controller with action named "input_by_month".
class ChartsController < ApplicationController
def input_by_month
@months = params[:months]
@input_by_month = InputByMonth.find(:all, :conditions => "user_id = '#{current_user.id}' AND end_time between '#{@months.months.ago.to_date}' AND '#{Time.now.to_date}'")
respond_to do |format|
format.html
format.xml
end
end
end