ActionView::MissingTemplate 在 Rails 中的 HAML Mailer 上
ActionView::MissingTemplate on HAML Mailer in Rails
Rails版本:5.0.2
haml-rails: 1.0.0
这在 Rails 4.2 => 5.0.2 升级之前有效。我有一个邮件程序 class:
app/mailers/password_mailer.rb
class PasswordMailer < ActionMailer::Base
default :from => ENV['ORG_FROM_EMAIL'] ||= "admin@example.com"
def password_reset(user)
@user = user
mail :to => user.email, :subject => "Password Reset"
end
end
app/views/password_mailer/password_reset.html.haml
= "Hi, #{@user.name} -"
%p
We received a request to reset your password.
%p
= link_to('Click here to reset', edit_admin_password_reset_url(@user.password_reset_token))
我这样称呼它:
PasswordMailer.password_reset(self).deliver_now
我现在得到:
ActionView::MissingTemplate - Missing template password_mailer/password_reset with "mailer". Searched in:
* "password_mailer"
我是否缺少 HAML 邮件程序模板的命名约定?这是布局问题吗?感谢您的指导。
这最终成为我们使用的 CMS 仅加载 CMS 的视图路径的问题。结案。
Rails版本:5.0.2 haml-rails: 1.0.0
这在 Rails 4.2 => 5.0.2 升级之前有效。我有一个邮件程序 class:
app/mailers/password_mailer.rb
class PasswordMailer < ActionMailer::Base
default :from => ENV['ORG_FROM_EMAIL'] ||= "admin@example.com"
def password_reset(user)
@user = user
mail :to => user.email, :subject => "Password Reset"
end
end
app/views/password_mailer/password_reset.html.haml
= "Hi, #{@user.name} -"
%p
We received a request to reset your password.
%p
= link_to('Click here to reset', edit_admin_password_reset_url(@user.password_reset_token))
我这样称呼它:
PasswordMailer.password_reset(self).deliver_now
我现在得到:
ActionView::MissingTemplate - Missing template password_mailer/password_reset with "mailer". Searched in:
* "password_mailer"
我是否缺少 HAML 邮件程序模板的命名约定?这是布局问题吗?感谢您的指导。
这最终成为我们使用的 CMS 仅加载 CMS 的视图路径的问题。结案。