我不知道这是否可能,但我只想在一个请求中下载一组pdf
这是我下载特定发票的方式:
def show
@invoice = Invoice.find_by_invoice_hash params[:hash]
respond_to do |format|
format.html
format.xml do
send_data File.read( @invoice.xml_path ), type: 'text/xml', filename: "invoice_#{ @invoice.id }.xml", disposition: 'attachment'
end
format.pdf do
render :pdf => @invoice.hash,
layout: 'pdf',
footer: {
right: "printed at: #{Date.today}"
}
end
end
end你建议我怎么做?
发布于 2012-07-11 14:15:00
HTTP不关心您在一个响应中发送的内容。请参阅this answer,了解如何在rails中发送复杂响应数据。
发布于 2012-07-11 12:41:28
HTTP被设计为一次只返回一个文件。您可以将这些文件压缩或压缩在一起,然后返回结果。
https://stackoverflow.com/questions/11424998
复制相似问题