I\'m using Prawn and Prawnto to display a PDF-based reports to the user, but in some circumstances, I\'d also like to save the PDF as an attachment to one of my models. I\'m usi
It should work if you just pass a File reference to that PDF to Paperclip.
require 'prawn'
pdf = Prawn::Document.new
pdf.text("Prawn Rocks")
pdf.render_file('/path/to/prawn.pdf')
pdf_file = File.open('/path/to/prawn.pdf')
# assuming your Paperclip association is named "pdf_attachment"
my_model.pdf_attachment = pdf_file