From f8eca1724901cd5b8949c6bdff362405ff7ed754 Mon Sep 17 00:00:00 2001 From: Kamil Trzcinski Date: Wed, 26 Aug 2015 17:14:22 +0100 Subject: Fix commits ordering when using PostgreSQL --- app/models/project.rb | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'app') diff --git a/app/models/project.rb b/app/models/project.rb index f0cf3a5..9b8815e 100644 --- a/app/models/project.rb +++ b/app/models/project.rb @@ -28,7 +28,7 @@ class Project < ActiveRecord::Base include ProjectStatus - has_many :commits, ->() { order(:committed_at, :id) }, dependent: :destroy + has_many :commits, ->() { order('CASE WHEN commits.committed_at IS NULL THEN 0 ELSE 1 END', :committed_at, :id) }, dependent: :destroy has_many :builds, through: :commits, dependent: :destroy has_many :runner_projects, dependent: :destroy has_many :runners, through: :runner_projects -- cgit v1.2.1