I am writing and invoicing application in Ruby On Rails, which is supposed to generate a PDF from a model so called out_invoice to an in_invoice under certain conditions.
The PDF for the out_invoice is already separately generated on demand using wicked_pdf gem basically having a HTML template and sending back the PDF inside the action and downloading it.
I have successfully programmed the duplication inside the out_invoice model which works fine for all values of the out_invoice. Including an attached PDF in a separate attribute.
But instead of generating the PDF and attaching it to the in_invoice. It fails. Some Controller/Model MVC thing I assume!
The PDF for the out_invoice is currently generated separately in a controller action so I tried copying the code: I tried rendering the template inside the model which seems to work fine, but "sending" is not defined for Rails models. If I just return the WickedPDF without sending it I get an error: ActiveSupport::MessageVerifier::InvalidSignature
Must be something super simple I am forgetting + I have no clue what is the reason for the error. I am not a front-end guy so don't want to use something else as the already existing HTML template for rendering. But worst case I write the template newly in another engine. Looked at Prawn but this means rewriting everything.
Can somebody help? Thanks!