简体   繁体   English

Rails Action Mailer Preview 不起作用,因为没有测试单元

[英]Rails Action Mailer Preview doesnt work because no testing unit

When I created my rails app following an online tutorial I made the mistake to add -T.当我按照在线教程创建 Rails 应用程序时,我错误地添加了 -T。 Since then I have continued to develop my own app on top of this app and I figured out that that -T meant that I dont want to install the testing unit.从那以后我继续在这个应用程序之上开发我自己的应用程序,我发现 -T 意味着我不想安装测试单元。 I am currently working on my emails but I cant figure out how to preview my emails that I generated using Action Mail generator ( rails g mailer UserMailer ).我目前正在处理我的电子邮件,但我不知道如何预览我使用 Action Mail 生成器 ( rails g mailer UserMailer ) 生成的电子邮件。 I have added config.action_mailer.preview_path = "#{Rails.root}/lib/mailer_previews" to my development.rb file but it doesnt seem to work.我已将config.action_mailer.preview_path = "#{Rails.root}/lib/mailer_previews"到我的 development.rb 文件中,但它似乎不起作用。 When I visit http://localhost:3000/lib/mailer_previews I get a "No route matches [GET] "/lib/mailer_previews" error and when I try to go to http://localhost:3000/rails/mailers I just get an empty white page. The email view file "welcome_email.html.erb" I am trying to see is located under the user_mailer folder. (btc my app is a rails app with a react front end) Any help is appreciated. Thank you当我访问http://localhost:3000/lib/mailer_previews 时,我收到“没有路由匹配 [GET]”/lib/mailer_previews”错误,当我尝试访问http://localhost:3000/rails/mailers 时,我只是得到一个空的白页。我想看到的电子邮件视图文件“welcome_email.html.erb”位于 user_mailer 文件夹下。(btc 我的应用程序是一个带有反应前端的 rails 应用程序)任何帮助表示赞赏。谢谢你

您需要设置config.action_mailer.show_previews = true ,默认为false

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM