电子邮件' email_calendar'在CalendarMailerPreview Rails Mailer Preview中找不到

时间:2015-03-22 16:29:57

标签: ruby-on-rails actionmailer

我创建了一个基本的邮件程序,但无法使用以下路径查看预览:http://localhost:3000/rails/mailers/calendar_mailer/calendar_email

这是我的邮件,预览和电子邮件正文代码:

calendar_mailer.rb:

class CalendarMailer < ActionMailer::Base
  default from: "notifications@cogsmart.com"

  def calendar_email(user)
    @user = user
    mail(to: @user.email, subject: 'Your Cogsmart To Do List')
  end
end

calendar_mailer_preview.rb:

class CalendarMailerPreview < ActionMailer::Preview

  def calendar_email
    CalendarMailer.calendar_email(User.first)
  end

end

calendar_email.html.erb:

<h1>Thanks @user.name for using Cogsmart, here's your calendar</h1>

1 个答案:

答案 0 :(得分:2)

如上所述here 预览需要进入测试 / mailers / previews文件夹