Sha256: 8a015180ad048ec5e927609714bd0fa718ad1838e85a9c28979381943518ed41

Contents?: true

Size: 636 Bytes

Versions: 5

Compression:

Stored size: 636 Bytes

Contents

module Apartment

  module Database

    def self.mysql2_adapter(config)
      Adapters::Mysql2Adapter.new config
    end
  end

  module Adapters

    class Mysql2Adapter < 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
        Apartment::Database.reset
        raise DatabaseNotFound, "Cannot find database #{environmentify(database)}"
      end
    end
  end
end

Version data entries

5 entries across 5 versions & 1 rubygems

Version Path
apartment-0.19.0 lib/apartment/adapters/mysql2_adapter.rb
apartment-0.18.0 lib/apartment/adapters/mysql2_adapter.rb
apartment-0.17.3 lib/apartment/adapters/mysql2_adapter.rb
apartment-0.17.2 lib/apartment/adapters/mysql2_adapter.rb
apartment-0.17.1 lib/apartment/adapters/mysql2_adapter.rb