简单的电子邮件会导致堆栈级别太深
我有邮件程序:
class AdminMailer < ActionMailer::Base
default :from => "[email protected]"
def message
mail(:to => "[email protected]",:subject => "test")
end
end
当我从控制器使用它们时:
def create
AdminMailer.message.deliver
redirect_to root_path
end
然后我得到了
SystemStackError in EmailsController#create
stack level too deep
“没有任何痕迹”等等。
I have mailer:
class AdminMailer < ActionMailer::Base
default :from => "[email protected]"
def message
mail(:to => "[email protected]",:subject => "test")
end
end
When I i use them from the controller :
def create
AdminMailer.message.deliver
redirect_to root_path
end
Then I got
SystemStackError in EmailsController#create
stack level too deep
Without any trace and so on.
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
我想你会发现
message
方法是 由 Action Mailer 保留。我建议您调用与此不同的方法来防止这种冲突。感谢 Ben Lee 在评论中指出了这一点的来源。
I think you'll find the
message
method is reserved by Action Mailer. I would recommend calling your method different from this to prevent this conflict.Thanks to Ben Lee in the comments for pointing out where this comes from.