Welcome to mirror list, hosted at ThFree Co, Russian Federation.

subquery.rb « database « gitlab « lib - gitlab.com/gitlab-org/gitlab-foss.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
blob: 2a6f39c6a2771523e0baaf7a5961171797beeafb (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
# frozen_string_literal: true

module Gitlab
  module Database
    module Subquery
      class << self
        def self_join(relation)
          t = relation.arel_table
          t2 = relation.arel.as('t2')

          relation.unscoped.joins(t.join(t2).on(t[:id].eq(t2[:id])).join_sources.first)
        end
      end
    end
  end
end