缺少设计邮件模板

Missing devise mailer template

我在设计时遇到模板丢失错误 - 这可能是一个简单的错误,但我看不到它。我有 -

../mailers/user_mailer.rb

class UserMailer < ::ActionMailer::Base
  include Devise::Mailers::Helpers
  default :from => "my@emailaddress.com"
  def confirmation_instructions(record, token, opts={})
      @token = token
      devise_mail(record, :confirmation_instructions, opts)
    end
...

...以及由设计生成的模板 -

../views/users/mailer/confirmation_instructions.html.erb

...但我收到模板丢失错误 -

Missing template user_mailer/confirmation_instructions with "mailer". Searched in: * "user_mailer"

为什么找不到邮件程序模板?

您的 confirmation_instructions.html.erb 文件应该在视图的 user_mailer 文件夹中。

这样的路径../views/user_mailer/confirmation_instructions.html.erb

代替这个../views/users/mailer/confirmation_instructions.html.erb