1
0
Fork 0
mirror of https://github.com/rails/rails.git synced 2022-11-09 12:12:34 -05:00

Remove info for deprecated database switching

Using the `database` kwarg with `connected_to` was deprecated in https://github.com/rails/rails/pull/37874, so this removes the example from the guide to avoid confusion.
This commit is contained in:
Eric Hayes 2019-12-20 16:16:23 -05:00 committed by GitHub
parent 6b633a2823
commit dfb4c1114b
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23

View file

@ -240,18 +240,6 @@ The "role" in the `connected_to` call looks up the connections that are connecte
connection handler (or role). The `reading` connection handler will hold all the connections
that were connected via `connects_to` with the role name of `reading`.
There also may be a case where you have a database that you don't always want to connect to
on application boot but may need for a slow query or analytics. After defining that database
in the `database.yml` you can connect by passing a database argument to `connected_to`
```ruby
ActiveRecord::Base.connected_to(database: { reading_slow: :animals_slow_replica }) do
# do something while connected to the slow replica
end
```
The `database` argument for `connected_to` will take a symbol or a config hash.
Note that `connected_to` with a role will look up an existing connection and switch
using the connection specification name. This means that if you pass an unknown role
like `connected_to(role: :nonexistent)` you will get an error that says