I have a βtechβ controller that has an action for sending email and invoices, from there we use Delayed :: Job.enqueue to drag the actual email action into the background process, which will be processed using the working dyno on Heroku .
Everything is working fine.
The problem I discovered is that my generated PDF invoice lives in the Heroku Web Dyno file system, and Worker has no idea where it is.
I will download the PDF during the generation process, it takes too much time.
So, I need to create an account on the working dynamics when it is sent to perform the action of the mail program to send a message.
I found this blog with some detailed instructions on creating a pdf file from a line: http://viget.com/extend/how-to-create-pdfs-in-rails
But it doesn't work for me at all, here is the code:
html = render_to_string(:action =>":show", :layout => "invoice.html")
@pdf = WickedPdf.new.pdf_from_string(html)
And the error:
"last_error"=>"undefined method `response_body=' for #<MailSenderJob:0x007fdf7e70a638>
I know this is from the docs:
WickedPdf.new.pdf_from_string(
render_to_string('templates/pdf.html.erb', :layout => 'pdfs/layout_pdf'),
:footer => {
:content => render_to_string(:layout => 'pdfs/layout_pdf')
}
)
And this code never worked for me at all.
What I get over and over again is error_body = error. As if he was not receiving an answer at all.
At the top of my file, I do:
include ActionController::Rendering
Because it is a module in which the render_to_string method is inside.
Any help at all - pay attention to your answer that I run this code on the Heroku WORKER dynamics, so if there is any dependency that I need to manually enable, which is naturally enabled on the web server, please let me know .