我一直在寻找的年龄,我仍然不能似乎想出解决办法,附加对虾PDF以电子邮件
我目前使用的prawn gem
,我希望能够在我invoice controllers
附加pdf
到email
create action
。我目前能够链接到我的invoices/show
页面生成的pdf到http://localhost:3000/invoices/297.pdf
,但我无法弄清楚如何将此PDF附加到电子邮件。
目前,我没有在任何地方保存生成的PDF和我的邮件看起来像这样
梅勒
class InvoiceMailer < ActionMailer::Base
default :from => "[email protected]"
def invoice_email(user)
@user = user
mail(:to => user.email, :subject => "Invoice Recieved")
end
end
而且我InvoicesController创建操作
{...}
respond_to do |format|
if @invoice.save
InvoiceMailer.invoice_email(@invoice.user).deliver
format.html { redirect_to invoice_url(@invoice, back_path:
{...}
如何添加我的发票这封邮件的附件?我需要在发送之前将发票存储在某个地方吗?