Wow, what a great site! I hope this question meets the requirements :-)
Generally, this question is about how to set response headers in Rails when using the render
method. Specifically, I have a markdown version of a document, which I would like the browser to save as a file by default, rather than display. I have found that you can set headers with the head
method, like this:
respond_to do |format|
format.html {...
format.text { head(:content_disposition => "attachment") }
end
But the options for render
don't work like this and I can't find anything to access the headers beforehand from the controller. Could anybody offer advice?
Thanks for taking the time to read my question.