I'm using Prawn gem to generate PDFs In my application...
app/controllers/orders.rb
class OrdersController < ApplicationController
...
def show
respond_to do |format|
format.html
format.pdf do
require "prawn/measurement_extensions"
...
#render pdf document
send_data pdf.render,
filename: "order_#{@order.id}.pdf",
type: 'application/pdf',
disposition: 'inline'
end
end
end
...
end
And It's working fine for displaying, But My questions are..
- How to -Automatically- save those generated pdfs in the public folder (folder for each day) after a successful
ordercreation? I've tried searching Prawn Documentation But I've found nothing. - How to show orders in only pdf format? I've Tried to Comment the
format.htmlline but It didn't work