summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorToon Claes <toon@gitlab.com>2019-07-16 14:07:42 +0200
committerToon Claes <toon@gitlab.com>2019-07-16 14:09:11 +0200
commitd5080eb5ffb0ffdb8133eee3039a4429c87a107d (patch)
treee69b7b5bcf373314315ab113c540b4c0e1301d74
parent1e99c1b0a7b4e80be5a0be40aebb7f4cad0077de (diff)
downloadgitlab-ce-d5080eb5ffb0ffdb8133eee3039a4429c87a107d.tar.gz
Revert "Workaround for Rails 5, where LIMIT..."tc-revert-rails5-workaround
This reverts commit 6823e7defb45dfd86d5258b40d6f82482d1ef451. Originally implemented in https://gitlab.com/gitlab-org/gitlab-ce/merge_requests/21839, but an error was reported in https://gitlab.com/gitlab-org/gitlab-ce/issues/51729 resulting in a workaround introduced in https://gitlab.com/gitlab-org/gitlab-ce/merge_requests/21879. Now Rails 5.2 is used, this workaround no longer seems needed, so this reverts it.
-rw-r--r--lib/gitlab/database/subquery.rb6
1 files changed, 1 insertions, 5 deletions
diff --git a/lib/gitlab/database/subquery.rb b/lib/gitlab/database/subquery.rb
index 10971d2b274..2a6f39c6a27 100644
--- a/lib/gitlab/database/subquery.rb
+++ b/lib/gitlab/database/subquery.rb
@@ -6,11 +6,7 @@ module Gitlab
class << self
def self_join(relation)
t = relation.arel_table
- # Work around a bug in Rails 5, where LIMIT causes trouble
- # See https://gitlab.com/gitlab-org/gitlab-ce/issues/51729
- r = relation.limit(nil).arel
- r.take(relation.limit_value) if relation.limit_value
- t2 = r.as('t2')
+ t2 = relation.arel.as('t2')
relation.unscoped.joins(t.join(t2).on(t[:id].eq(t2[:id])).join_sources.first)
end