我是新手使用邮件并阅读一些教程,但不能为我的生活解决为什么这个错误出现
Missing template layouts/mailer with {:locale=>[:en], :formats=>[:text], :variants=>[], :handlers=>[:erb, :builder, :raw, :ruby, :haml]}. Searched in:
* "/Users/paulmcguane/RoR/barista/app/views"
* "/Users/paulmcguane/.rbenv/versions/2.2.1/lib/ruby/gems/2.2.0/gems/devise-3.5.6/app/views"
new_record_notification.text.erb
Hi,
A new record has been added: <%= @record.name %>
Thanks
model_mailer.rb
class ModelMailer < ApplicationMailer
# Subject can be set in your I18n file at config/locales/en.yml
# with the following lookup:
#
# en.model_mailer.new_record_notification.subject
#
def new_record_notification(record)
@record = record
mail(to: 'email@address') do |format|
format.text
end
end
end
答案 0 :(得分:1)
您最有可能使用布局&#39;邮件&#39;在您的ApplicationMailer类中。使用现有布局或根本不使用布局。