Commit 1d766bfb authored by Jan Provaznik's avatar Jan Provaznik

Replace `.exists` with `EXISTS ()`

`.exists` should not be used because it's an internal ActiveRecord
method, but we can easily generate the same sql query with `EXISTS`.
parent bee339ad
......@@ -63,7 +63,7 @@ module Boards
def without_board_labels(issues)
return issues unless board_label_ids.any?
issues.where.not(issues_label_links.limit(1).arel.exists)
issues.where.not('EXISTS (?)', issues_label_links.limit(1))
end
def issues_label_links
......@@ -71,10 +71,8 @@ module Boards
end
def with_list_label(issues)
issues.where(
LabelLink.where("label_links.target_type = 'Issue' AND label_links.target_id = issues.id")
.where("label_links.label_id = ?", list.label_id).limit(1).arel.exists
)
issues.where('EXISTS (?)', LabelLink.where("label_links.target_type = 'Issue' AND label_links.target_id = issues.id")
.where("label_links.label_id = ?", list.label_id).limit(1))
end
end
end
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment