1
0
Fork 0
mirror of https://github.com/rails/rails.git synced 2022-11-09 12:12:34 -05:00

Migrations: make default database connection overridable

This commit is contained in:
Jeremy Kemper 2009-02-04 12:21:22 -08:00
parent 922c528d42
commit 6f8ed1cd3f

View file

@ -338,6 +338,10 @@ module ActiveRecord
self.verbose = save self.verbose = save
end end
def connection
ActiveRecord::Base.connection
end
def method_missing(method, *arguments, &block) def method_missing(method, *arguments, &block)
arg_list = arguments.map(&:inspect) * ', ' arg_list = arguments.map(&:inspect) * ', '
@ -345,7 +349,7 @@ module ActiveRecord
unless arguments.empty? || method == :execute unless arguments.empty? || method == :execute
arguments[0] = Migrator.proper_table_name(arguments.first) arguments[0] = Migrator.proper_table_name(arguments.first)
end end
ActiveRecord::Base.connection.send(method, *arguments, &block) connection.send(method, *arguments, &block)
end end
end end
end end