I'm trying to create an XML file that the user can download, but I'm
not sure how to do it. I'm able to create an action in my controller
that renders to a .rxml template, which allows the user to view the
XML in their browser window, but I don't want them to have to see the
XML, then save it to their computer. I'd like to have them click a
link and have a standard Save/Open dialog box (in IE) appear. Do I
need to save the XML file to my server filesystem first, or can I just
stream the file straight to the user?
I think you need to set the header "Content-Disposition" to
"Attachment"... that makes the browser treat the file as something to
download. Can't remember off the top of my head how to set a response
header in rails, but google should help with that.