Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

simple email causes 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.

like image 661
speedingdeer Avatar asked Dec 16 '22 08:12

speedingdeer


1 Answers

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.

like image 160
Ryan Bigg Avatar answered Dec 28 '22 20:12

Ryan Bigg