title: Creating collection of pdfs with wicked_pdf
body: <p>I have problem collection of pdfs file and save it to file. I create this for show action so when I clink the link it generate pdf and store them in public folder:</p>
  
  <pre><code>def show
      add_breadcrumb "Inovice details"
      respond_to do |format|
        format.html
        format.pdf do
          render :pdf =&gt; "file_name", :save_to_file =&gt; Rails.root.join('public', "Invoice no. #{@invoice.format_id}.pdf")
        end
        format.csv {send_data Invoice.where(id: @invoice.id).to_csv,
          filename: "Invoice no. #{@invoice.format_id}.csv"}
      end
    end
  </code></pre>
  
  <p>Now I want to create the same functionality but for collection of objects. For examples I have 10 invoices and I want for all of them generate pdf and save it to public folder. I was trying something like that: </p>
  
  <pre><code>def index
        @invoices = @company.invoices
      respond_to do |format|
        format.html
        format.js
        format.csv { send_data @invoices.to_csv }
        format.pdf do
          @invoices.each do |invoice|
            render :pdf =&gt; "file_name", :save_to_file =&gt; Rails.root.join('public', "Invoice no. #{invoice.format_id}.pdf")
          end
        end
      end
      authorize @invoices
    end
  </code></pre>
  
  <p>But it didnt work. I have no ideas how to solve this problem. I will be grateful for every help.</p>