lib/apartment/adapters/mysql_adapter.rb in apartment-0.14.4 vs lib/apartment/adapters/mysql_adapter.rb in apartment-0.15.0
- old
+ new
@@ -1,18 +1,29 @@
module Apartment
module Database
- def self.mysql_adapter(config)
+ def self.mysql2_adapter(config)
Adapters::MysqlAdapter.new config
end
end
module Adapters
class MysqlAdapter < AbstractAdapter
+ protected
+
+ # Connect to new database
+ # Abstract adapter will catch generic ActiveRecord error
+ # Catch specific adapter errors here
+ #
+ # @param {String} database Database name
+ #
+ def connect_to_new(database)
+ super
+ rescue Mysql2::Error
+ raise DatabaseNotFound, "Cannot find database #{environmentify(database)}"
+ end
end
-
end
-
end
\ No newline at end of file