Project

General

Profile

Actions

Refactor #29710

closed

Change false where conditions to `none`

Added by Tomer Brisker almost 4 years ago. Updated over 3 years ago.

Status:
Closed
Priority:
Normal
Assignee:
Category:
Database
Target version:
-
Difficulty:
Triaged:
No
Fixed in Releases:
Found in Releases:

Description

There are multiple places where we use conditions like "where(1=0)" or "where(id<0)" etc. because we want to preserve the active relation object. Since Rails 4 there is `none` method that achieves the same goal with null object pattern, so the eventual query won't even be sent to the DB - https://api.rubyonrails.org/classes/ActiveRecord/QueryMethods.html#method-i-none


Related issues 1 (0 open1 closed)

Related to Foreman - Bug #31538: Each smart class parameter appears twice, when having two environmentsClosedTomer BriskerActions
Actions #1

Updated by The Foreman Bot almost 4 years ago

  • Status changed from New to Ready For Testing
  • Assignee set to Tomer Brisker
  • Pull request https://github.com/theforeman/foreman/pull/7641 added
Actions #2

Updated by The Foreman Bot over 3 years ago

  • Fixed in Releases 2.3.0 added
Actions #3

Updated by Tomer Brisker over 3 years ago

  • Status changed from Ready For Testing to Closed
Actions #4

Updated by Tomer Brisker over 3 years ago

  • Related to Bug #31538: Each smart class parameter appears twice, when having two environments added
Actions

Also available in: Atom PDF