method
protocol_adapters
v8.0.0 -
Show latest stable
- Class:
ActiveRecord
protocol_adapterspublic
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.