在我的Rails应用程序中,我正在尝试将发票附加到电子邮件中:
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
该 InvoicePdf 是一个Prawn PDF文档:
class InvoicePdf < Prawn::Document
def initialize(order, view)
draw_pdf
end
def draw_pdf
# pdf stuff
end
end
我在电子邮件中没有附件。我究竟做错了什么?任何提示都会受到欢迎和赞赏。
编辑: 我正在使用的Rails版本是 3.0.x的