首页
学习
活动
专区
圈层
工具
发布
社区首页 >问答首页 >ActionView::MissingTemplate:缺少带有"mailer“的模板signup_mailer/welcome_message。搜索位置:* "signup_mailer“

ActionView::MissingTemplate:缺少带有"mailer“的模板signup_mailer/welcome_message。搜索位置:* "signup_mailer“
EN

Stack Overflow用户
提问于 2016-08-26 22:53:26
回答 1查看 1.1K关注 0票数 8

我正在使用Sidekiq异步发送我的电子邮件,但一直存在无法找到电子邮件模板的错误。它不是一致的,因为它时不时地工作(就像我在测试的时候)。您可以看到,我甚至尝试指定了模板的路径和名称。

我在Honeybadger中收到的错误是:ActionView::MissingTemplate: Missing template signup_mailer/welcome_message with "mailer". Searched in: * "signup_mailer"

app/mailers/signup_mailer.rb

代码语言:javascript
复制
class SignupMailer < ActionMailer::Base
  default from: 'hello@companycam.com'

  def welcome_message(company, user)
    @company = company
    @user = user
    @web_url = root_url
    mail(to: @company.email, subject: 'Welcome to CompanyCam', template_path: 'signup_mailer', template_name: 'welcome_message')
  end
end

您可以在图片中看到,实际上在app/views/signup_mailer/中有一个名为welcome_message.html.erb的视图和文本版本

EN

回答 1

Stack Overflow用户

发布于 2016-09-10 16:57:05

你能试试这个吗。

代码语言:javascript
复制
class SignupMailer < ActionMailer::Base
  default from: 'hello@companycam.com' 
  layout "welcome_message"

  def welcome_message(company, user)
    @company = company
    @user = user
    @web_url = root_url
    mail(to: @company.email, subject: 'Welcome to CompanyCam')
  end
end
票数 0
EN
页面原文内容由Stack Overflow提供。腾讯云小微IT领域专用引擎提供翻译支持
原文链接:

https://stackoverflow.com/questions/39169148

复制
相关文章

相似问题

领券
问题归档专栏文章快讯文章归档关键词归档开发者手册归档开发者手册 Section 归档