Manually build the SQL so that it properly skips Rails.

This commit is contained in:
Lin Jen-Shin
2016-06-09 16:00:24 +08:00
parent fc51bf3248
commit 5bd077bd41
+2 -1
View File
@@ -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