blob: 33cd1a491f3ca4297a9fa199185accb776c0349f (
plain)
1
2
3
4
5
6
7
8
9
10
11
|
class UnionFinder
def find_union(segments, klass)
if segments.length > 1
union = Gitlab::SQL::Union.new(segments.map { |s| s.select(:id) })
klass.where("#{klass.table_name}.id IN (#{union.to_sql})")
else
segments.first
end
end
end
|