[Rails] Explanation of "alias_method"

Alex Young alex at blackkettle.org
Wed Feb 1 13:39:58 GMT 2006


d|vision|factory wrote:
> Can anyboby explain me what actully happens there. In my opinion, 
> 'find_without_something' should represent the original 'find' method, so 
> there should not be any output. For a strange reason it outputs 0,0,1,1 
> which in fact means that it calls 'find_with_something' twice.

It might be something to do with the fact that the base find() method 
calls itself recursively, which means your alias will intercept that 
recursive call as well as the initial.  Then again, it might not...

-- 
Alex


More information about the Rails mailing list