From ae8171ddc5886102421e356888f03d06e7bf5131 Mon Sep 17 00:00:00 2001 From: Jeremy Kemper Date: Sun, 19 Nov 2006 11:09:31 +0000 Subject: Migration benchmark wrappers use alias_method_chain. Closes #6456. git-svn-id: http://svn-commit.rubyonrails.org/rails/trunk@5563 5ecf4fe2-1ee6-0310-87b1-e25e094e27de --- activerecord/lib/active_record/migration.rb | 9 ++++----- 1 file changed, 4 insertions(+), 5 deletions(-) (limited to 'activerecord/lib') diff --git a/activerecord/lib/active_record/migration.rb b/activerecord/lib/active_record/migration.rb index b132b3d820..0afb5c29e1 100644 --- a/activerecord/lib/active_record/migration.rb +++ b/activerecord/lib/active_record/migration.rb @@ -191,11 +191,11 @@ module ActiveRecord cattr_accessor :verbose class << self - def up_using_benchmarks #:nodoc: + def up_with_benchmarks #:nodoc: migrate(:up) end - def down_using_benchmarks #:nodoc: + def down_with_benchmarks #:nodoc: migrate(:down) end @@ -209,7 +209,7 @@ module ActiveRecord end result = nil - time = Benchmark.measure { result = send("real_#{direction}") } + time = Benchmark.measure { result = send("#{direction}_without_benchmarks") } case direction when :up then announce "migrated (%.4fs)" % time.real; write @@ -231,8 +231,7 @@ module ActiveRecord case sym when :up, :down klass = (class << self; self; end) - klass.send(:alias_method, "real_#{sym}", sym) - klass.send(:alias_method, sym, "#{sym}_using_benchmarks") + klass.send(:alias_method_chain, sym, "benchmarks") end ensure @ignore_new_methods = false -- cgit v1.2.3