Forum: Ruby on Rails Taking advantage of template generation from within a model?

Announcement (2017-05-07): www.ruby-forum.com is now read-only since I unfortunately do not have the time to support and maintain the forum any more. Please see rubyonrails.org/community and ruby-lang.org/en/community for other Rails- und Ruby-related community platforms.
Wes G. (Guest)
on 2008-10-21 03:06
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
This topic is locked and can not be replied to.