diff options
author | Jeremy Kemper <jeremy@bitsweat.net> | 2006-11-19 11:09:31 +0000 |
---|---|---|
committer | Jeremy Kemper <jeremy@bitsweat.net> | 2006-11-19 11:09:31 +0000 |
commit | ae8171ddc5886102421e356888f03d06e7bf5131 (patch) | |
tree | a24e593a3bf04a29a8ecca50237dd8bf8aaab2cf /activerecord | |
parent | 229ea6537459d9d55c2f140bce14fdfe45b4472e (diff) | |
download | rails-ae8171ddc5886102421e356888f03d06e7bf5131.tar.gz rails-ae8171ddc5886102421e356888f03d06e7bf5131.tar.bz2 rails-ae8171ddc5886102421e356888f03d06e7bf5131.zip |
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
Diffstat (limited to 'activerecord')
-rw-r--r-- | activerecord/lib/active_record/migration.rb | 9 |
1 files changed, 4 insertions, 5 deletions
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 |