Patch #33367

Use more efficient "exists?" instead of "first" in tests when checking the existence of rows

Added by Go MAEDA over 1 year ago. Updated over 1 year ago.

Status:ClosedStart date:
Priority:NormalDue date:
Assignee:Go MAEDA% 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?.

use-exists-instead-of-first.patch Magnifier (6.67 KB) Go MAEDA, 2020-04-29 11:03

Associated revisions

Revision 19746
Added by Go MAEDA over 1 year ago

Use more efficient "exists?" instead of "first" in tests when checking the existence of rows (#33367).

Patch by Go MAEDA.

History

#1 Updated by Go MAEDA over 1 year ago

  • Subject changed from Use more efficient "exists?" instead of "first” in tests when checking the existence of rows to Use more efficient "exists?" instead of "first" in tests when checking the existence of rows

#2 Updated by Go MAEDA over 1 year ago

  • Target version set to 4.2.0

Setting the target version to 4.2.0.

#3 Updated by Go MAEDA over 1 year ago

  • Status changed from New to Closed
  • Assignee set to Go MAEDA

Committed the patch.

Also available in: Atom PDF