In my Rails application, I'm trying to attach the invoice to the email:
def invoice(invoice)
attachment :content_disposition => "attachment",
:body => InvoicePdf.new(invoice),
:content_type => "application/pdf",
:filename => 'invoice.pdf'
mail(:to => @user.email, :subject => "Your Invoice")
end
The InvoicePdf is a Prawn PDF document:
class InvoicePdf < Prawn::Document
def initialize(order, view)
draw_pdf
end
def draw_pdf
# pdf stuff
end
end
I get no attachments in the email. What am I doing wrong? Any tips would be welcomed and appreciated.
Edit: The Rails version I'm using is 3.0.x