class method self.protocol_adapters

Ruby on Rails 7.2.3.2

Since v7.2.3.2

Available in: v7.2.3.2 v8.0.5.1 v8.1.3.1 edge

Provides a mapping between database protocols/DBMSs and the underlying database adapter to be used. This is used only by the DATABASE_URL environment variable.

Example

DATABASE_URL="mysql://myuser:mypass@localhost/somedatabase"

The above URL specifies that MySQL is the desired protocol/DBMS, and the application configuration can then decide which adapter to use. For this example the default mapping is from mysql to mysql2, but :trilogy is also supported.

ActiveRecord.protocol_adapters.mysql = "mysql2"

The protocols names are arbitrary, and external database adapters can be registered and set here.

Source
# File activerecord/lib/active_record.rb, line 520
  singleton_class.attr_accessor :protocol_adapters

Defined in activerecord/lib/active_record.rb line 520 · View on GitHub · Improve this page · Find usages on GitHub

Defined in ActiveRecord

Type at least 2 characters to search.

Use the arrow keys to navigate results, Enter to open one, Escape to close.

Keyboard shortcuts

/
Focus search
⌘K / Ctrl-K
Command palette
?
This help
Esc
Close