class method
self.protocol_adapters
Ruby on Rails 8.0.4
Since v7.2.3Provides 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 491
singleton_class.attr_accessor :protocol_adapters
Defined in activerecord/lib/active_record.rb line 491
· View on GitHub
· Improve this page
· Find usages on GitHub
Defined in ActiveRecord