Previously, relation calculations such as
count would make a query
even when passed a contradiction,
means passing an empty array for eg:-
It does not make sense to call a database for such contradictory relations.
So, before Rails 7 was introduced,
the database was called if the relation used for
maximum would be contradictory.
As it can be seen,
it would make a query to the database even when passed a contradiction.
Now after Rails 7, it avoids making a query to the database.
for more details.