rails/rails — pull request #9119 by dazuma (2013-01-30 03:45:45+00:00)
Title: Raise an exception with a useful message if a rake task is requested for an unknown adapter

Currently, if one of the ActiveRecord::Tasks::DatabaseTasks entry points is run using a connection adapter that doesn't provide an implementation for DatabaseTasks, Rails raises a NoMethodError due to calling new on a nil class. (Because it fails to find a corresponding implementation, and then tries to instantiate it.) This is not a very helpful exception for this case.

This is a small change that provides a "default" DatabaseTasks implementation. This default implementation merely raises a more useful exception when invoked. We may decide, in the future, to provide true default implementations of some rake tasks.

Test case provided.