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

ruby-on-rails – 缺少带有{:locale => [:en],:formats =&

发布时间:2020-12-17 04:26:47 所属栏目:百科 来源:网络整理
导读:我正在关注michael harlt rails教程,但是我收到了这个错误 Missing template layouts/mailer with {:locale=[:en],:formats=[:html],:variants=[],:handlers=[:raw,:erb,:html,:builder,:ruby,:coffee,:jbuilder]}. Searched in: * “/home/ubuntu/workspace
我正在关注michael harlt rails教程,但是我收到了这个错误

Missing template layouts/mailer with {:locale=>[:en],:formats=>[:html],:variants=>[],:handlers=>[:raw,:erb,:html,:builder,:ruby,:coffee,:jbuilder]}. Searched in: * “/home/ubuntu/workspace/app/views”

预览帐户激活时

这是我的user_mailer.rb

class UserMailer < ApplicationMailer

  def account_activation(user)
    @user = user
    mail to: user.email,subject: "Account activation"
  end

  def password_reset
    @greeting = "Hi"

    mail to: "to@example.org"
  end
end

并且错误突出显示的行

mail to: user.email,subject: "Account activation"

我尝试在user_mailer.rb中添加layout’mailer’,但它不起作用.

编辑:
Here is the screenshot of the error

The screenshot of my folders

解决方法

如果您还没有,则需要名为user_mailer的视图中的文件夹,并且您需要为每个方法(account_activation.html.erb& password_reset.html.erb)提供一个文件.这是您的电子邮件模板的位置.

(编辑:李大同)

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

    推荐文章
      热点阅读