Use where.not instead of where(NOT IN)

This way we simplify the code a bit and reduce our usage of raw SQL.
This commit is contained in:
Javi Martín
2020-05-19 16:03:32 +02:00
parent f427c757ba
commit 1b34c061bb
4 changed files with 6 additions and 7 deletions

View File

@@ -45,10 +45,9 @@ class UserSegments
def self.not_supported_on_current_budget
author_ids(
User.where(
"id NOT IN (?)",
Vote.select(:voter_id).where(votable: current_budget_investments).distinct
)
User.where.not(
id: Vote.select(:voter_id).where(votable: current_budget_investments).distinct
)
)
end