我不知道这是否可行,但我只想在一个请求中下载一组 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
你建议我怎么做?