diff options
author | Jan Provaznik <jprovaznik@gitlab.com> | 2018-05-27 17:53:21 +0200 |
---|---|---|
committer | Jan Provaznik <jprovaznik@gitlab.com> | 2018-05-28 08:59:33 +0200 |
commit | 1d766bfbdf8f11d176beb99d139edc6150e3f032 (patch) | |
tree | 67556f23c32343d213aa0a8442ad4d4f7c0bb2bd /app/services/boards/issues/list_service.rb | |
parent | bee339ad10fc4d4bd94a406eb0d24d7759d73972 (diff) | |
download | gitlab-ce-1d766bfbdf8f11d176beb99d139edc6150e3f032.tar.gz |
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`.
Diffstat (limited to 'app/services/boards/issues/list_service.rb')
-rw-r--r-- | app/services/boards/issues/list_service.rb | 8 |
1 files changed, 3 insertions, 5 deletions
diff --git a/app/services/boards/issues/list_service.rb b/app/services/boards/issues/list_service.rb index ac70a99c2c5..5a961ac89e4 100644 --- a/app/services/boards/issues/list_service.rb +++ b/app/services/boards/issues/list_service.rb @@ -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 |