规范/邮件程序/预览版中不提供 Rails 邮件程序预览

编程入门 行业动态 更新时间:2024-10-24 22:19:32
本文介绍了规范/邮件程序/预览版中不提供 Rails 邮件程序预览的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧! 问题描述

我希望能够在浏览器中预览我的电子邮件.

I would like to be able to preview my emails in the browser.

我正在使用 Rspec 并在 spec/mailers/previews 中有以下预览设置:

I am using Rspec and have the following preview setup in spec/mailers/previews:

# Preview all emails at localhost:3000/rails/mailers/employee_mailer class EmployeeMailerPreview < ActionMailer::Preview def welcome Notifier.welcome_email(Employee.first) end end

当我尝试访问它时,出现以下错误:

When I try to access this I get the following error:

AbstractController::ActionNotFound at /rails/mailers/employee_mailer Mailer preview 'employee_mailer' not found

但是,当我将预览代码放在测试/邮件程序/预览中时它有效.

However, when I put the code for the preview inside of tests/mailers/previews it works.

如何配置我的 Rails 应用以在 spec/mailers/previews 中查找预览?

How can I configure my Rails app to look for the previews inside of spec/mailers/previews?

推荐答案

使用

config.action_mailer.preview_path = "#{Rails.root}/spec/mailers/previews"

在 config/development.rb 中定义预览所在的路径.

in config/development.rb to define the path where previews are located.

更多推荐

规范/邮件程序/预览版中不提供 Rails 邮件程序预览

本文发布于:2023-11-17 06:49:44,感谢您对本站的认可!
本文链接:https://www.elefans.com/category/jswz/34/1609207.html
版权声明:本站内容均来自互联网,仅供演示用,请勿用于商业和其他非法用途。如果侵犯了您的权益请与我们联系,我们将在24小时内删除。
本文标签:邮件   程序   中不   预览版   Rails

发布评论

评论列表 (有 0 条评论)
草根站长

>www.elefans.com

编程频道|电子爱好者 - 技术资讯及电子产品介绍!