Remove unnecessary ORDER BY clause from `forked_to_project_id` subquery

This commit is contained in:
mhasbini 2017-03-30 15:38:48 +03:00
parent 26ba13f203
commit dc15abaa22
2 changed files with 8 additions and 2 deletions

View File

@ -635,8 +635,10 @@ class User < ActiveRecord::Base
end
def fork_of(project)
links = ForkedProjectLink.where(forked_from_project_id: project, forked_to_project_id: personal_projects)
links = ForkedProjectLink.where(
forked_from_project_id: project,
forked_to_project_id: personal_projects.unscope(:order)
)
if links.any?
links.first.forked_to_project
else

View File

@ -0,0 +1,4 @@
---
title: Remove unnecessary ORDER BY clause from `forked_to_project_id` subquery
merge_request:
author: mhasbini