Taking advantage of template generation from within a model?


#1

All,

I have a controller action/view pair that successfully generates a PDF
using Prawnto.

I like the idea of the view specifying the details of the PDF generation
in a view file (x.pdf.prawn).

However, I would like to be able to generate a PDF and instead of
rendering it to a view, just generate it and save it to a file. I’m
doing this inside of a model method.

Obviously, I can pull the PDF generation into a module and call it from
both places, but I was wondering if there’s any clean way to take
advantage of the template that I already have without going through too
many gyrations.

Thanks,
Wes