Using Ruby 1.8.6 / Rails 2.3.2
I am noticing that any method called on any of my ActiveRecord model classes is returning nil
instead of a NoMethodError. Besides annoying, this is breaking the dynamic finders (find_by_name
, find_by_id
, etc.) because they always return nil
even where records exist. Standard classes that don't derive from ActiveRecord::Base aren't affected.
Is there a way to track down what is intercepting method_missing before ActiveRecord::Base?
UPDATE:
After switching to 1.8.7, I have found (thanks to @MichaelKohl) that the will_paginate plugin is handling method_missing first. But will_paginate has been around in our system (unaltered) for quite a while and the culprit must be something later up the chain. Any ideas how to see what comes next in this chain?
UPDATE:
It turned out that there was a gem (annotate-2.4.0) that was monkey patching ActiveRecord::Base#method_missing
as a blank method. Uninstalling the gem solved my problem. Although none of the answers given actually found the problem, the answer by @Yanhao came closest as it only needed a minor tweak to discover the offending aliased method