Strange mailer behaviour in Rails 4.2

The code inside test method doesn’t get executed at all.

class MailSender < ActionMailer::Base
default :from => ‘[email protected]

def test()
should_die_here
mail(
:to => ‘[email protected]’,
:subject => ‘Test’,
:text => ‘Text’).deliver
end
end

##########
In controller:

MailSender.test() # nothing happen
MailSender.test1() # throws error, method test1 not found.

First call should die in should_die_here line, but nothing happens.
Funny thing is if I try to call nonexisted method I get error, that
method does not exist.

When I reverted to rails 4.1.19 everything works as expected.

Thanks for your advice
TheR

On 17 February 2015 at 09:56, Damjan R. [email protected] wrote:

The code inside test method doesn’t get executed at all.

class MailSender < ActionMailer::Base
default :from => ‘[email protected]

def test()

Should that not be
def self.test()
if you want to call it using
MailSender.test()

Colin

Colin L. wrote in post #1168195:

On 17 February 2015 at 09:56, Damjan R. [email protected] wrote:

The code inside test method doesn’t get executed at all.

class MailSender < ActionMailer::Base
default :from => ‘[email protected]

def test()

Should that not be
def self.test()
if you want to call it using
MailSender.test()

Colin

No. It is called from controller.

by
TheR