mardi 3 novembre 2015

How to pass two object to prawn pdf

I have following structure in my controller and i want to pass two object to generate pdf, below is my controller code but its not working.

def show    
   @customer = Customer.find(params[:id]) 
   @orders = Orders.find(params[:id])
   @pdf = Prawn::Document.new()  

    respond_to do |format|
      format.html # show.html.erb
      format.xml  { render :xml => @customer }
      format.xml  { render :xml => @orders}
      format.pdf  { render :layout => false  }
      pdf.render_file {path_to_file}
end

I also tried @customers.orders = @orders but it didn't work.

Is there any way to get it done ?

Aucun commentaire:

Enregistrer un commentaire