From: ts Date: 2006-05-18T18:12:11+09:00 Subject: Re: alias_method >>>>> "B" == =?GB2312?B?wfXDz72t?= writes: B> ./lib/activerecord/extension.rb:18:in `alias_method': undefined method B> `establis B> h_connection' for class `ActiveRecord::Base' (NameError), but the B> ActiveRecord:Base.respond_to(:establis B> h_connection) is true. You want probably alias with instance_eval moulon% cat b.rb #!/usr/bin/ruby module A class B def self.b end end end def included(klass) klass.instance_eval do alias c b end p "instance_eval : #{klass.respond_to?(:c)}" begin klass.class_eval do alias d b end rescue p "class_eval : #{$!}" end end p "A::B : #{A::B.respond_to?(:b)}" included(A::B) moulon% moulon% ./b.rb "A::B : true" "instance_eval : true" "class_eval : undefined method `b' for class `A::B'" moulon% Guy Decoux