Rails 3: PDF generation with wicked_pdf suddenly does not work anymore ? [undefined method `virtual_path']
-
18-04-2021 - |
Question
Our platform has been online for a while and working just fine. Our customers are able to download their invoices in PDF format just fine.
We've been working on a upgrades for a few month, and just today we noticed that "suddenly" non of our PDF generation with wicked_pdf and wkhtmltopdf no longer worked...
I have absolutely no idea why, I checked everything I could think of: - routes - initializers - gems - etc.
Everything seems to be fine, same as the actual only version.
We have not changed Rails or Ruby version. Everything is pretty much the same: - Ruby 1.8.7 REE - Rails 3.0.10
The error we are getting is:
Rendered groups/clients/proforma.pdf.haml (103.4ms)
Sent data toto.pdf (2.7ms)
Completed 500 Internal Server Error in 6892ms
NoMethodError (undefined method `virtual_path' for text template:ActionView::Template::Text):
app/controllers/groups/clients_controller.rb:980:in `proforma'
app/controllers/groups/clients_controller.rb:976:in `proforma'
lib/include/flash_session_cookie_middleware.rb:16:in `call'
lib/include/flash_session_cookie_middleware.rb:16:in `call'
The controller looks like:
def proforma
@request = WireRequest.where(:_id => params[:id], :status => :pending).first
respond_to do |format|
format.html {render :layout => false}
format.pdf do
unless @request.nil?"
render(:pdf => "PROFORMA_#{@request.invoice_num}", :layout => 'pdf')
end
end
end
end
Any ideas of what could be going wrong? I have no more ideas :(
Solution
I already had this kind of issue using the new relic rpm for developers.
I forked the gem here.