Last night I updated an app to Rails 4, and was about to pull my hair out and file a bug in ActiveRecord because the 4.1.5 change mysteriously broke my user authentication - and the stack trace, about a method missing that was clearly in the ActiveRecord source code, made absolutely zero sense.
As it turned out, the change broke an obscure gem that I'd been using (routing_concerns - don't use it!), and since it seemed to have nothing to do with ActiveRecord, I had no idea that it had been shadowing an internal module with its own version that was missing that method! But how I ended up tracking it down is the tip here.
As it turns out, once you drop into a debugger like [byebug](https://github.com/deivid-rodriguez/byebug), you can call the method `method` on any object, passing a symbol for the method name, and then call `source_location` on the resulting object... and it tells you exactly which gem and file is responsible for that method's implementation. For instance, where self is an ActiveRecord instance:
[[:req, :new_attributes], [:opt, :options]]
You may find that this tells you exactly why nothing was behaving as you'd expect from the source code!