class method self.protocol_adapters

Ruby on Rails 7.2.3

Since v7.2.3

Available in: v7.2.3 v8.0.4 v8.1.2

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.

↑↓ navigate · open · esc close