I am confused about sending emails/push notifications/SMS inside of activerecord callbacks.
I got the idea from DHH’s series On Writing Software Well, episode 2, from 2018, where he showed a basecamp Mention class that does after_commit :deliver which delivers emails and push notifications.
https://youtu.be/M3JPTOTqsnE?t=1087
That seems like a great way to structure stuff, and I immediately went out and created a Reminder model that did the same thing.
But then I found some other, slightly older, posts from DHH that said that emails should not go in activerecord callbacks.
https://news.ycombinator.com/item?id=7336185
https://dhh.dk/2012/emails-are-views.html
https://dhh.dk/posts/43-think-of-emails-as-views-delivered-through-smtp
Was this just a change in 37signals’ writing style from the early 2010s to 2018 when that video came out? Or is the guidance still to try as best as you can to keep any user facing communications inside a controller, and the Mention class just needed to deliver inside of a callback because mentions as a whole are a side concern of recordings, and it would be worse to try to force that mention#deliver into the recordings controller?