开发者

simple email causes stack level too deep

开发者 https://www.devze.com 2023-04-12 10:59 出处:网络
I have mailer: class AdminMailer < ActionMailer::Base default :from => \"pejottest@gmail.com\" def message

I have mailer:

class AdminMailer < ActionMailer::Base
  default :from => "pejottest@gmail.com" 
  def message
    mail(:to => "pejottest@gmail.com",:subject => "test")
  end
end

When I i use them from the controller :

def create
  AdminMailer.message.deliver
  redirect_to root_path
end

Th开发者_开发技巧en I got

SystemStackError in EmailsController#create
stack level too deep

Without any trace and so on.


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.

0

精彩评论

暂无评论...
验证码 换一张
取 消

关注公众号