Fix GeoNode#projects query for selective sync

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