Shortly before our winter break, I ran into the following error message while updating a mailer:

(object doesn't support #inspect)

Here’s the code:

def notify
   mail(
     from: '[email protected]',
     to: '[email protected]',
     subject: 'it works',
     body: 'hello world',
   ).deliver_now
 end
end

What happened?

notify has some expectations for how it should be used. Specifically, it’s expected to return a mail object. deliver_now is a method you can call on a mail object, and doesn’t return a mail object. Attaching that deliver_now to the mail() meant that notify was no longer returning a mail object.

Solution: return the expected object. I kicked out the deliver_now and made sure notify returned a mail object, then delivered that mail object: Mailer.notify.deliver_now

Problem solved, mail created and delivered.