download multiples files in one request

Posted by alexperto on Stack Overflow See other posts from Stack Overflow or by alexperto
Published on 2012-07-11T03:11:36Z Indexed on 2012/07/11 3:15 UTC
Read the original article Hit count: 125

I don't know if it is posible, but I'd like to download a group of pdf's in only one request

this is the way I download a particular invoice:

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

What do you suggest me to do?

© Stack Overflow or respective owner

Related posts about ruby-on-rails

Related posts about ruby