Patch #33367
Use more efficient "exists?" instead of "first" in tests when checking the existence of rows
Status: | Closed | Start date: | ||
---|---|---|---|---|
Priority: | Normal | Due date: | ||
Assignee: | % Done: | 0% | ||
Category: | Code cleanup/refactoring | |||
Target version: | 4.2.0 |
Description
When you check if any row exists, using exists?
that does not return ActiveRecord objects is more efficient than using first
.
The attached patch replaces first
with exists?
.
Associated revisions
Use more efficient "exists?" instead of "first" in tests when checking the existence of rows (#33367).
Patch by Go MAEDA.