Commit cb41470c authored by Andreas Brandl's avatar Andreas Brandl

Merge branch 'tc-revert-rails5-workaround' into 'master'

Revert "Workaround for Rails 5, where LIMIT..."

See merge request gitlab-org/gitlab-ce!30780
parents 4fc9254f d5080eb5
...@@ -6,11 +6,7 @@ module Gitlab ...@@ -6,11 +6,7 @@ module Gitlab
class << self class << self
def self_join(relation) def self_join(relation)
t = relation.arel_table t = relation.arel_table
# Work around a bug in Rails 5, where LIMIT causes trouble t2 = relation.arel.as('t2')
# 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')
relation.unscoped.joins(t.join(t2).on(t[:id].eq(t2[:id])).join_sources.first) relation.unscoped.joins(t.join(t2).on(t[:id].eq(t2[:id])).join_sources.first)
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