加入收藏 | 设为首页 | 会员中心 | 我要投稿 李大同 (https://www.lidatong.com.cn/)- 科技、建站、经验、云计算、5G、大数据,站长网!
当前位置: 首页 > 百科 > 正文

ruby-on-rails – 在动作管理器模板中渲染部分内容

发布时间:2020-12-17 03:11:59 所属栏目:百科 来源:网络整理
导读:我试图在动作管理器模板中使用现有的部分,比如… 我的merchant_offer.txt.html.erb %= render :partial = "offers/offer",:locals = {:offer = @offer} % Notifier.rb(我的邮件程序类): def merchant_offer(offer) subject "New Offer from #{offer.merchan
我试图在动作管理器模板中使用现有的部分,比如…

我的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

该商品部分在另一个名为offer的视图文件夹中

但它抛出了一个缺少的tempalate错误.

有没有办法在邮件程序中重复使用现有视图?

谢谢

解决方法

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

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

(编辑:李大同)

【声明】本站内容均来自网络,其相关言论仅代表作者个人观点,不代表本站立场。若无意侵犯到您的权利,请及时与联系站长删除相关内容!

    推荐文章
      热点阅读