2010-06-20 93 views
5

我试图使用现有的部分在的ActionMailer模板,像..渲染谐音中的ActionMailer模板

我merchant_offer.txt.html.erb

<%= render :partial => "offers/offer", :locals => {:offer => @offer} %> 

Notifier.rb(我的邮件类):在另一个视图文件夹

def merchant_offer(offer) 
    subject "New Offer from #{offer.merchant.name}" 
    from "[email protected]" 
    recipients [email protected] 
    sent_on Time.now 
    body :offer => offer 
end 

的报价部分称为报价

但抛出缺失tempalate错误。

有没有办法在邮寄者tempalates中重新使用现有的视图部分?

谢谢

回答

5

您应该能够从邮件模板渲染部分。

我相信错误发生在您的merchant_offer视图中。尝试将'merchant_offer.txt.html.erb'重命名为'merchant_offer.html.erb'