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:
@@ -96,7 +96,7 @@ class UsersController < ApplicationController
|
||||
disabled_commentables << "Debate" unless Setting["process.debates"]
|
||||
disabled_commentables << "Budget::Investment" unless Setting["process.budgets"]
|
||||
if disabled_commentables.present?
|
||||
all_user_comments.where("commentable_type NOT IN (?)", disabled_commentables)
|
||||
all_user_comments.where.not(commentable_type: disabled_commentables)
|
||||
else
|
||||
all_user_comments
|
||||
end
|
||||
|
||||
Reference in New Issue
Block a user