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です