Ruby on rails 设计自定义电子邮件视图

Ruby on rails 设计自定义电子邮件视图,ruby-on-rails,devise,Ruby On Rails,Devise,我想发送电子邮件指令,使用Desive gem重置用户密码。为此,我覆盖密码\u控制器 class PasswordsController < Devise::PasswordsController respond_to :json def create account = ::Account.find_by(email: password_reset_params[:email]) account&.send_reset_password_instruc

我想发送电子邮件指令,使用Desive gem重置用户密码。为此,我覆盖
密码\u控制器

class PasswordsController < Devise::PasswordsController
  respond_to :json

  def create
    account = ::Account.find_by(email: password_reset_params[:email])
    account&.send_reset_password_instructions
    head 200
  end

  private

  def password_reset_params
    params.require(:account).permit(:email)
  end
end
但我收到的不是上述电子邮件,而是标准邮件:

Hello test@test.com!

Someone has requested a link to change your password. You can do this through the link below.

Change my password

If you didn't request this, please ignore this email.

Your password won't change until you access the link above and create a new one.
我应该换点别的吗? 在
initializers/designe
中,我得到了
config.mailer='designe::mailer'
更改路线:

devise_for :accounts, singular: 'account', path: '', controllers: {
passwords:     'api/v1/account/passwords',
}

在Max的评论中提出建议之后,我所要做的就是将mailer视图文件从
app/views/accounts/mailer/reset_password_instructions.html.erb
移动到->
app/views/designe/mailer/reset_password_instructions.html.erb
在Max的评论中提出建议之后,我所要做的就是将mailer视图文件从
app/views/accounts/mailer/reset\u password\u instructions.html.erb
to->
app/views/designe/mailer/reset\u password\u instructions.html.erb

将文件移动到
app/views/designe/mailer/reset\u password\u instructions.html.erb
。请记住,邮件程序不会通过控制器查找视图路径。@max您是对的,现在它可以工作了!谢谢,请自行回答。将文件移动到
app/views/designe/mailer/reset\u password\u instructions.html.erb
。请记住,邮件程序不会通过控制器查找视图路径。@max您是对的,现在它可以工作了!谢谢你自己回答吧。
<p>Hello <%= @resource.email %>!</p>

<p>This is a password reset request, click on the link below:</p>

<p><%= link_to 'Change my password', edit_password_url(@resource, reset_password_token: @token) %></p>