From: Brian Candler Date: 2011-09-30T22:58:00+09:00 Subject: Re: using alias_method before function definition Reginald Tan wrote in post #1024307: > The example would work if I put the profile method > after the method name, but is there a cleaner solution to make this > work? I don't think so. The trouble is, alias_method acts on the version of the method *as it was defined at that time*. So you could define a dummy method first, and copy it with alias_method, but when you redefine it the alias would still point to the first one. def foo puts "Version 1" end alias :bar :foo def foo puts "Version 2" end foo # prints "Version 2" bar # prints "Version 1" HTH, Brian. -- Posted via http://www.ruby-forum.com/.