【发布时间】:2016-02-06 04:06:18
【问题描述】:
我目前正在尝试使用我的 Rails api 服务器设置邮件程序。目前,我收到以下错误:ActionView::MissingTemplate (Missing template user_mailer/welcome_email with "mailer". Searched in:
* "user_mailer"
):
目前在views/user_mailer/welcome_email.html.erb有一个视图
我的users_mailer.rb 如下所示:
class UserMailer < ApplicationMailer
default from: 'xx@xxx.com'
def welcome_email(user)
@user = user
@url = 'http://0.0.0.0:3000/login'
mail(to: 'xxx@xxxxx.com', subject: 'Welcome to the site')
end
end
我的控制器这样调用邮件程序:
def show
UserMailer.welcome_email(@user).deliver_now
render json: @user
end
我试过设置 config.api_only = false 没有任何运气。
【问题讨论】:
-
有人也遇到了和你一样的问题github.com/rails-api/rails-api/issues/23 .. :)
-
我重启了好几次应用,也停止了好几次spring。
-
我没有看到任何明显的东西。您可以在 repo 中添加问题。
-
感谢您为我查看代码。我在 Rails 存储库中发布了一个新问题。
-
您能否在帖子本身中提供问题链接。这样未来的读者也可以得到帮助。谢谢
标签: ruby-on-rails ruby-on-rails-5