在app/mailers/ I中有user_mailer.rb,定义为
class UserMailer < ActionMailer::Base
def abc
@greeting = "Hi"
mail to: "engr.imrannaqvi@gmail.com" ,
subject: "Question Reporting"
end
endapplication_helper.rb定义为
class ApplicationMailer < ActionMailer::Base
default from: "from@example.com"
layout 'mailer'
end视图/mailer/ cantain abc.html.erb定义为
<p>Hi Imran Haider,</p>
It's from the content当我从控制器调用它时
def report_spam
UserMailer.abc().deliver
render json: {msg: 'success'}
end它让我犯了错误
缺少带有"mailer“的模板user_mailer/abc。搜索:* "user_mailer“
我不知道我错在哪里
发布于 2016-03-25 07:05:43
我不知道为什么,但我认为我的application_mailer.rb工作不好。我删除了application_mailer.rb,并将user_mailer文件夹移出了views中的mailer文件夹,它起了作用(#Abhe注释,下面的问题是最有用的)
https://stackoverflow.com/questions/36215156
复制相似问题