Ruby on rails 设计:带有确认链接的欢迎邮件预览 轨道4.2.5 ruby 2.3

Ruby on rails 设计:带有确认链接的欢迎邮件预览 轨道4.2.5 ruby 2.3,ruby-on-rails,ruby,ruby-on-rails-4,devise,Ruby On Rails,Ruby,Ruby On Rails 4,Devise,我正在使用Desive并向用户发送两封电子邮件 注册后(欢迎使用确认链接) 更改电子邮件后(带有确认链接) 这两种邮件都是通过自定义设计邮件发送的: class UserMailer < Devise::Mailer layout 'email' helper :application include Devise::Controllers::UrlHelpers def confirmation_instructions(record, token,

我正在使用Desive并向用户发送两封电子邮件

  • 注册后(欢迎使用确认链接)
  • 更改电子邮件后(带有确认链接)
这两种邮件都是通过自定义设计邮件发送的:

class UserMailer < Devise::Mailer
    layout 'email'
    helper :application
    include Devise::Controllers::UrlHelpers

    def confirmation_instructions(record, token, options={})
        if record.pending_reconfirmation?
            options[:template_name] = 'confirmation_instructions'
        else
            options[:template_name] = 'welcome_email'
        end
        super
    end
end
class UserMailer
我可以预览设计默认电子邮件的删除问题(确认\u指令、重置\u密码\u指令或解锁\u指令)。我的问题是关于自定义电子邮件预览(欢迎使用带有确认url的电子邮件)

如何在my UserMailerPreview中预览带有确认url的欢迎电子邮件?我是否有可能或者应该改变我的路线

我目前的预览:

class UserMailerPreview < ActionMailer::Preview
    def confirmation_instructions
        UserMailer.confirmation_instructions(User.first, '123456', {})
    end
end
class UserMailerPreview
我不知道我是否正确理解了你的问题,但预览电子邮件有一个很好的窍门:看看这个问题@akz92实际上因为Rails 4.2.1我们有一个功能,可以在没有任何窍门的情况下做到这一点@miloshes I可以正常预览默认电子邮件(确认指示、重置指示或解锁指示)。我的问题是关于自定义电子邮件预览(欢迎使用带有确认url的电子邮件)。