From 6f8ed1cd3fa595a59d7a19d8d383836b456ac803 Mon Sep 17 00:00:00 2001 From: Jeremy Kemper Date: Wed, 4 Feb 2009 12:21:22 -0800 Subject: Migrations: make default database connection overridable --- activerecord/lib/active_record/migration.rb | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) (limited to 'activerecord/lib/active_record') diff --git a/activerecord/lib/active_record/migration.rb b/activerecord/lib/active_record/migration.rb index 15350cf1e1..657acd6dc0 100644 --- a/activerecord/lib/active_record/migration.rb +++ b/activerecord/lib/active_record/migration.rb @@ -338,6 +338,10 @@ module ActiveRecord self.verbose = save end + def connection + ActiveRecord::Base.connection + end + def method_missing(method, *arguments, &block) arg_list = arguments.map(&:inspect) * ', ' @@ -345,7 +349,7 @@ module ActiveRecord unless arguments.empty? || method == :execute arguments[0] = Migrator.proper_table_name(arguments.first) end - ActiveRecord::Base.connection.send(method, *arguments, &block) + connection.send(method, *arguments, &block) end end end -- cgit v1.2.3