hi, i want to extend the ActiveRecord::Base.establish_connection, i do
it as fellow:

module ActiveRecordExtension
def self.included(klass) #nodoc
klass.extend(ClassMethods)
klass.class_eval do
alias_method :old_establish_connection, :establish_connection
alias_method :establish_connection, :my_establish_connection
end
end

module ClassMethods
def my_establish_connection(spec = nil)
old_establish_connection(spec)
end
end
end

when it be included, then a error issue:

./lib/activerecord/extension.rb:18:in `alias_method': undefined method
`establis
h_connection' for class `ActiveRecord::Base' (NameError), but the
ActiveRecord:Base.respond_to(:establis
h_connection) is true.

why?