我在我的 Rails 应用程序中使用 WickedPDF 来生成 PDF 文件。它在我的本地机器上运行良好。在生产中,我在日志中看到以下错误:
Started GET "/financieel/facturen/2.pdf" for 81.205.74.167 at 2012-09-19 14:58:37 +0200
Processing by InvoicesController#show as PDF
Parameters: {"id"=>"2"}
***************WICKED***************
Rendered invoices/show.pdf.haml (6.9ms)
Completed 500 Internal Server Error in 38ms
NoMethodError (undefined method `chomp' for nil:NilClass):
app/controllers/invoices_controller.rb:22:in `block (2 levels) in show'
app/controllers/invoices_controller.rb:17:in `show'
在 invoices_controller.rb 中没有什么异常:
format.pdf do
render pdf: 'factuur'
end