Ruby on Rails - Storing XML in a Temporary File

Emmat

New Member
I want to be able to store my xml into a temporary file and then send it to another method in another controller to be processed. Currently it will not allow me to read the file, once sent, because it is a private method.Controller #1\[code\]xml_doc = Nokogiri::XML(@builder.to_xml)@tempfile = Tempfile.new('xml')@tempfile.write(xml_doc)redirect_to upload_xml_admin_events_path(:file => @tempfile)\[/code\]Controller #2Version #1\[code\]xml = params[:file].readxmldoc = Nokogiri::XML(xml)\[/code\]Gives me this error: undefined method `read' for "File:0x6ebfb00":StringVersion #2 \[code\]xml = params[:file]xml.openxmldoc = Nokogiri::XML(xml)\[/code\]Gives me this error: private method `open' called for "#File:0x6a12bd8":String
 
Back
Top