I have an XML file containing data which I need to access in the controller. For example, the XML file contains cpu usage and cpu load and other such information. I need to collect this information into a controller and display it in a graph (chartdirector). How do I get the values from the XML file to the controller?
Open the file and use Nokogiri (gem) to parse the XML.
Did you checkout the nokogiri plugin? Also there is ReXML
Where would you recommend putting all of the parsing code, in a Model or Controller? I'm very new at working with MVC, but to be it seems that an XML document, being a representation of data, would be handled by a Model. Am I wrong? Thanks!
Where would you recommend putting all of the parsing code, in a Model or Controller? I'm very new at working with MVC, but to be it seems that an XML document, being a representation of data, would be handled by a Model. Am I wrong? Thanks!
You are completely correct, put the reading and parsing in a model that is not derived from AR::base
Colin