Skip to content
Snippets Groups Projects

Drop default ORDER scope when calling a find method on a Sortable model

Merged Douwe Maan requested to merge dm-drop-default-scope-on-sortable-finders into master
All threads resolved!
Files
5
@@ -227,7 +227,7 @@ class Projects::IssuesController < Projects::ApplicationController
def issue
return @issue if defined?(@issue)
# The Sortable default scope causes performance issues when used with find_by
@noteable = @issue ||= @project.issues.where(iid: params[:id]).reorder(nil).take!
@noteable = @issue ||= @project.issues.find_by!(iid: params[:id])
return render_404 unless can?(current_user, :read_issue, @issue)
Loading