Fix GeoNode#projects query for selective sync

parent 17e7f5ba
...@@ -135,8 +135,7 @@ class GeoNode < ActiveRecord::Base ...@@ -135,8 +135,7 @@ class GeoNode < ActiveRecord::Base
if selective_sync? if selective_sync?
relations = namespaces.map { |namespace| namespace.all_projects.select(:id) } relations = namespaces.map { |namespace| namespace.all_projects.select(:id) }
Project.unscoped Project.where("id IN (#{Gitlab::SQL::Union.new(relations).to_sql})")
.from("(#{Gitlab::SQL::Union.new(relations).to_sql}) #{Project.table_name}")
else else
Project.all Project.all
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