我创建了一个新邮件使用的邮件生成轨道5:为什么我无法使用名为message的邮件程序方法?
$ rails g mailer mymailer message
Rails的创建application_mailer,mymailer_mailer,观点和测试。好。
这是由轨道所产生的邮件:
NoMethodError: undefined method `reject!' for nil:NilClass
花了大约两个小时后,双击:但每当我试图发送邮件,我得到了以下错误
class MymailerMailer < ApplicationMailer
# Subject can be set in your I18n file at config/locales/en.yml
# with the following lookup:
#
# en.mymailer_mailer.message.subject
#
def message
@greeting = "Hi"
mail to: "[email protected]"
end
end
- 检查每个配置文件我已决定将方法更改为bla
...
Voilà:它的工作,好的!但为什么?
顺便说一句:message
我发现的方法是从ActionMailer::MessageDelivery
,但没有提到Rails指南。