Before the introduction of this exception, we where raising
a `ConnectionNotEstablished` and users might be rescuing that exception
already.
As the goal of the new exception was to be more specific, we should be
subclassing `ConnectionNotEstablished` to keep the old behaviour.
The ordering examples use `Customer#orders_count` for ordering which
results in beginner-unfriendly examples like:
Customer.order(:orders_count)
Having two unrelated types of `order` can be confusing.
As Customer has many Orders it's probably better to replace the Customer
with Book to avoid any confusion.
Not having `orders_count` also makes it easier to grep for 'order' in
the guide. This also is a reason the `Order.none` example is replaced
with `Book.none`, besides it being more consistent with the example
below it.
Co-authored-by: Ryuta Kamizono <kamipo@gmail.com>
In #42794 we added the ability to hide some configurations for database
tasks. This is useful if you want your application to connect to a
database but if it's a separate service not run any tasks against it.
After adding this functionality I realized that the `configs_for`
argument no longer makes sense. `include_replicas` would include all of
them but ones with `database_tasks: false` aren't necessarily replicas.
This change deprecates `include_replicas` in favor of `include_hidden`
which will display all configurations. When not passed, this will
continue to return all writing connections that we want to perform tasks
on.
I found an unexpected use of assertion in the block of `assert_raise`
when I implemented https://github.com/rubocop/rubocop-minitest/pull/137.
It is expected to be asserted after an exception is raised in
`assert_raise` block, but in actually it is not asserted after an
exception is raised. Therefore, this PR removes or updates assertions
that have not been asserted after an exception has raised.
This PR will add `rubocop-minitest` and enable
`Minitest/UnreachableAssertion` cop to able similar auto-detection,
but will remove `rubocop-minitest` from this PR if you don't like it.
There is no need for this nowadays. you could have a directory somehwere
that is not in autoload_paths, but you want the once loader to manage.
At the same time, when we setup the main loader, we remove any directory
in the autoload_once_paths, since Zeitwerk does not allow loaders to
have overlapping root directories.
Followup to #42794. This fixes a rubocop failure for the spacing before
the curly brace and uses a more common/correct approach to testing the
error message.