Skip to content

Commit

Permalink
Migrations: make default database connection overridable
Browse files Browse the repository at this point in the history
  • Loading branch information
jeremy committed Feb 4, 2009
1 parent 922c528 commit 6f8ed1c
Showing 1 changed file with 5 additions and 1 deletion.
6 changes: 5 additions & 1 deletion activerecord/lib/active_record/migration.rb
Original file line number Diff line number Diff line change
Expand Up @@ -338,14 +338,18 @@ def suppress_messages
self.verbose = save
end

def connection
ActiveRecord::Base.connection
end

def method_missing(method, *arguments, &block)
arg_list = arguments.map(&:inspect) * ', '

say_with_time "#{method}(#{arg_list})" do
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
Expand Down

0 comments on commit 6f8ed1c

Please sign in to comment.