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: 'me@...',
     to: 'me+testing@...',
     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.

Older post

Designing Your Apprenticeship Program for Outcomes

Want to learn more about apprenticeship? Read our previous article introducing software apprenticeship. There are many reasons to invest in an apprenticeshi...

Newer post

A primer on setting up your remote employee

Last night, I was talking with a tech lead of a local company. He was struggling with supporting two of his teammates who are newer to their roles (let's cal...