I love Ruby on Rails. It is normally as intuitive as it gets, so needless to say, I was surprised when I got the following error:
Expected Object is not missing constant ContactNotifier!
Ah, I thought. I did not define a constant (a common bug). Then I did a double take. The error told me, in fact, that I was NOT missing a constant. Huh?
The problem was that I was calling “new” on an ActionMailer class and I had not defined a constructor. I later found out I should not have been instantiating an ActionMailer class anyway (you just need to call a delivery method with the parameters you want to send). Regardless, why the heck does Rails throw such a cryptic error instead of, say, “Method not found”?