Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Browse files

Migrations: make default database connection overridable

  • Loading branch information...
commit 6f8ed1cd3fa595a59d7a19d8d383836b456ac803 1 parent 922c528
@jeremy jeremy authored
Showing with 5 additions and 1 deletion.
  1. +5 −1 activerecord/lib/active_record/migration.rb
View
6 activerecord/lib/active_record/migration.rb
@@ -338,6 +338,10 @@ def suppress_messages
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 @@ def method_missing(method, *arguments, &block)
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
Please sign in to comment.
Something went wrong with that request. Please try again.