Skip to content

Instantly share code, notes, and snippets.

@rmaceissoft
Created March 30, 2012 18:28
Show Gist options
  • Save rmaceissoft/2253751 to your computer and use it in GitHub Desktop.
Save rmaceissoft/2253751 to your computer and use it in GitHub Desktop.
pdf generation
NoMethodError in Personal_invoices#show
Showing D:/PERFILES/Marquez/Jaratech/Workspace/branches/tt2-rails/app/views/personal_invoices/show.pdf.prawn where line #17 raised:
undefined method `headers=' for #<Prawn::Table:0x75612d8>
Extracted source (around line #17):
14: ["Email address", "#{@invoice.paypal_email}"]
15: ]
16:
17: pdf.table(invoice_info, :headers => ["Column A","Column B"])
18:
19: invoice_items = @invoice.personal_invoice_items.all.map { |item| [item.project.name, item.description, item.hours, item.rate]}
20:
Rails.root: D:/PERFILES/Marquez/Jaratech/Workspace/branches/tt2-rails
Application Trace | Framework Trace | Full Trace
app/views/personal_invoices/show.pdf.prawn:17:in `_app_views_personal_invoices_show_pdf_prawn___836651295_63953232_0'
app/controllers/personal_invoices_controller.rb:52:in `show'
app/controllers/personal_invoices_controller.rb:48:in `show'
Request
Parameters:
{"format"=>"pdf",
"id"=>"10"}
Show session dump
Show env dump
Response
Headers:
None
pdf.font_size 24
pdf.text_box "Invoice"
pdf.move_down 50
pdf.font_size 14
to_company = "Dream Staffing LLC"
to_address = "105 Court St., Suite 401 New Haven, CT 06511"
invoice_info = [["Invoice Number", "#{@invoice.render_number}"],
["Invoice Date", "#{@invoice.date}"],
["From", "#{@invoice.complete_name} \n #{@invoice.address}"],
["To", "#{to_company} \n #{to_address}"],
["Pay mode", "Bank Wire"],
["Email address", "#{@invoice.paypal_email}"]
]
pdf.table(invoice_info, :headers => ["Column A","Column B"])
invoice_items = @invoice.personal_invoice_items.all.map { |item| [item.project.name, item.description, item.hours, item.rate]}
pdf.move_down 30
pdf.table invoice_items
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment