Rails中HAML Mailer上的ActionView :: MissingTemplate

时间:2017-07-26 20:36:31

标签: ruby-on-rails actionmailer actionview

Rails版本:5.0.2 haml-rails:1.0.0

这在Rails 4.2 =>之前有效。 5.0.2升级。我有一个邮件类:

应用/邮寄者/ 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

应用/视图/ 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邮件模板是否缺少命名约定?这是布局问题吗?谢谢你的指导。

1 个答案:

答案 0 :(得分:0)

这最终成为我们使用的CMS仅加载CMS的视图路径的问题。案件结案。