Object::InstanceMethods is a confusing error
What’s worse is that when I get this error on windows – It’s all over. I update my database file: same error. I drop and re-create all my databases manually: same error. The only thing I’ve found that works is if I kill my whole damn development folder and check out fresh. I realize that this makes no sense at all, but it works. Is windows hiding or caching some file somewhere? No idea. Luckily I’ve been mostly been developing on Linux for the last few days.
This error is another example of something I’ve been struggling with since I started writing Ruby: The errors tend to be unhelpful. Java and other strongly typed languages fail fast. If you give some method the wrong class, it blows up right away. In dynamic langs like Ruby the method doesn’t care what it gets so long as it can respond to the methods it called on it (the famous “duck typing”). Maybe the method just passes it along, or maybe it gets something off that the bad object and tries to do some stuff with it. So you can get pretty far down the stack from where you actually made your error before the interpreter blows up -- Which makes debugging a challenge. Now I know this added flexibility is what makes Ruby so cool. But it’s not without its costs.