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

缺少带有"mailer“的模板user_mailer/abc。搜索:* "user_mailer“
EN

Stack Overflow用户
提问于 2016-03-25 06:32:02
回答 1查看 1K关注 0票数 0

在app/mailers/ I中有user_mailer.rb,定义为

代码语言:javascript
复制
class UserMailer < ActionMailer::Base

  def abc
    @greeting = "Hi"

    mail    to: "engr.imrannaqvi@gmail.com" ,
            subject: "Question Reporting"
  end
end

application_helper.rb定义为

代码语言:javascript
复制
class ApplicationMailer < ActionMailer::Base
  default from: "from@example.com"
  layout 'mailer'
end

视图/mailer/ cantain abc.html.erb定义为

代码语言:javascript
复制
<p>Hi Imran Haider,</p>
It's from the content

当我从控制器调用它时

代码语言:javascript
复制
  def report_spam
    UserMailer.abc().deliver    
    render json: {msg: 'success'}
 end

它让我犯了错误

缺少带有"mailer“的模板user_mailer/abc。搜索:* "user_mailer“

我不知道我错在哪里

EN

回答 1

Stack Overflow用户

发布于 2016-03-25 07:05:43

我不知道为什么,但我认为我的application_mailer.rb工作不好。我删除了application_mailer.rb,并将user_mailer文件夹移出了views中的mailer文件夹,它起了作用(#Abhe注释,下面的问题是最有用的)

票数 0
EN
页面原文内容由Stack Overflow提供。腾讯云小微IT领域专用引擎提供翻译支持
原文链接:

https://stackoverflow.com/questions/36215156

复制
相关文章

相似问题

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