Permalink
Browse files

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
  • Loading branch information...
1 parent 229ea65 commit ae8171ddc5886102421e356888f03d06e7bf5131 @jeremy jeremy committed Nov 19, 2006
Showing with 4 additions and 5 deletions.
  1. +4 −5 activerecord/lib/active_record/migration.rb
@@ -191,11 +191,11 @@ class Migration
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 @@ def migrate(direction)
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 @@ def singleton_method_added(sym) #:nodoc:
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

0 comments on commit ae8171d

Please sign in to comment.