{:offe-6ren">
gpt4 book ai didi

ruby-on-rails - 在 actionmailer 模板中呈现部分

转载 作者:行者123 更新时间:2023-12-04 05:52:03 27 4
gpt4 key购买 nike

我正在尝试在 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 "xxx@gmail.com"
recipients xxx@
sent_on Time.now
body :offer => offer
end

报价部分在另一个名为报价的 View 文件夹中

但它会抛出一个缺失的模板错误。

有没有办法在邮件模板中重用现有的 View 部分?

谢谢

最佳答案

您应该能够从邮件程序模板呈现部分内容。

我相信错误出在您的 Merchant_offer View 中。尝试将“merchant_offer.txt.html.erb”重命名为“merchant_offer.html.erb”

关于ruby-on-rails - 在 actionmailer 模板中呈现部分,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/3078191/

27 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com