From 5bd077bd41653ead0925fd775fd07ba3fd26468f Mon Sep 17 00:00:00 2001 From: Lin Jen-Shin Date: Tue, 7 Jun 2016 17:43:18 +0800 Subject: [PATCH] Manually build the SQL so that it properly skips Rails. --- app/models/ci/runner.rb | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/app/models/ci/runner.rb b/app/models/ci/runner.rb index 6565a12fe6..bb5340a0f0 100644 --- a/app/models/ci/runner.rb +++ b/app/models/ci/runner.rb @@ -29,7 +29,8 @@ module Ci scope :specific_for, ->(project) do # TODO: That `to_sql` is needed to workaround a weird Rails bug. # Without that, placeholders would miss one and couldn't match. - where(locked: false).where.not(id: project.runners.to_sql).specific + where(locked: false). + where.not("id IN (#{project.runners.select(:id).to_sql})").specific end validate :tag_constraints