Skip to Content Skip to Search

module ActiveRecord::ConnectionAdapters

Public class methods

Registers a custom database adapter.

Can also be used to define aliases.

Example

ActiveRecord::ConnectionAdapters.register("megadb", "MegaDB::ActiveRecordAdapter", "mega_db/active_record_adapter")

ActiveRecord::ConnectionAdapters.register("mysql", "ActiveRecord::ConnectionAdapters::TrilogyAdapter", "active_record/connection_adapters/trilogy_adapter")
Source code GitHub
# File activerecord/lib/active_record/connection_adapters.rb, line 22
def register(name, class_name, path = class_name.underscore)
  @adapters[name.to_s] = [class_name, path]
end

Namespace

Definition files

49 More Less