From 17de909a42fa5d641eb9554e94fee59fb0762cbc Mon Sep 17 00:00:00 2001 From: Kamil Trzcinski Date: Tue, 6 Oct 2015 16:25:27 +0200 Subject: Fix broken grouping sql clause when rendering commits for CI --- app/controllers/ci/projects_controller.rb | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/app/controllers/ci/projects_controller.rb b/app/controllers/ci/projects_controller.rb index 64d544acfd9..adb913a783f 100644 --- a/app/controllers/ci/projects_controller.rb +++ b/app/controllers/ci/projects_controller.rb @@ -14,9 +14,10 @@ module Ci def show @ref = params[:ref] - @commits = @project.commits.group(:sha).reverse_order + @commits = @project.commits.reverse_order if @ref - builds = @project.builds.where(ref: @ref).select(:commit_id).distinct + # unscope is required, because of default_scope defined in Ci::Build + builds = @project.builds.unscope(:select, :order).where(ref: @ref).select(:commit_id).distinct @commits = @commits.where(id: builds) end @commits = @commits.page(params[:page]).per(20) -- cgit v1.2.1