diff --git a/activerecord/CHANGELOG.md b/activerecord/CHANGELOG.md index 285d93e0b73e0..ee9a40fb6d453 100644 --- a/activerecord/CHANGELOG.md +++ b/activerecord/CHANGELOG.md @@ -1,3 +1,9 @@ +* Create an `active_record_connection_adapters` load hook which is run after + `ActiveRecord::ConnectionAdapters` is defined. It can be used to register custom + connection adapters. + + *Andrew Novoselac* + * `DatabaseConfigurations#configs_for` can accept a symbol in the `name` parameter. *Andrew Novoselac* diff --git a/activerecord/lib/active_record/connection_adapters.rb b/activerecord/lib/active_record/connection_adapters.rb index d4be1c084debc..8f3415c54539d 100644 --- a/activerecord/lib/active_record/connection_adapters.rb +++ b/activerecord/lib/active_record/connection_adapters.rb @@ -69,6 +69,8 @@ def resolve(adapter_name) # :nodoc: register "trilogy", "ActiveRecord::ConnectionAdapters::TrilogyAdapter", "active_record/connection_adapters/trilogy_adapter" register "postgresql", "ActiveRecord::ConnectionAdapters::PostgreSQLAdapter", "active_record/connection_adapters/postgresql_adapter" + ActiveSupport.run_load_hooks(:active_record_connection_adapters, self) + eager_autoload do autoload :AbstractAdapter end diff --git a/guides/source/engines.md b/guides/source/engines.md index 6d50f89acf8df..f759b0e0a13cb 100644 --- a/guides/source/engines.md +++ b/guides/source/engines.md @@ -1486,6 +1486,7 @@ These are the load hooks you can use in your own code. To hook into the initiali | `ActiveModel::Model` | `active_model` | | `ActiveRecord::Base` | `active_record` | | `ActiveRecord::TestFixtures` | `active_record_fixtures` | +| `ActiveRecord::ConnectionAdapters` | `active_record_connection_adapters` | | `ActiveRecord::ConnectionAdapters::PostgreSQLAdapter` | `active_record_postgresqladapter` | | `ActiveRecord::ConnectionAdapters::Mysql2Adapter` | `active_record_mysql2adapter` | | `ActiveRecord::ConnectionAdapters::TrilogyAdapter` | `active_record_trilogyadapter` |