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

@@ -158,7 +158,7 @@ class ProposalsController < ApplicationController
.sort_by_confidence_score.limit(Setting["featured_proposals_number"])
if @featured_proposals.present?
set_featured_proposal_votes(@featured_proposals)
@resources = @resources.where("proposals.id NOT IN (?)", @featured_proposals.map(&:id))
@resources = @resources.where.not(id: @featured_proposals)
end
end
end