diff options
author | tiagonbotelho <tiagonbotelho@hotmail.com> | 2016-07-22 21:57:46 +0100 |
---|---|---|
committer | tiagonbotelho <tiagonbotelho@hotmail.com> | 2016-07-22 21:57:46 +0100 |
commit | 850813d29867aac5935e1128880784f97071a6d8 (patch) | |
tree | d5da375e2dcdaf54d653bc50aa75d2e4dd7f096e /app/models/commit_status.rb | |
parent | 2d64bda01f983c43f915e96bd5bf8fcb0790eb0e (diff) | |
parent | 08b5bec2fa3beb2880d451a9d9270813b0a22519 (diff) | |
download | gitlab-ce-850813d29867aac5935e1128880784f97071a6d8.tar.gz |
Merge branch 'master' into filter-branch-by-name
Diffstat (limited to 'app/models/commit_status.rb')
-rw-r--r-- | app/models/commit_status.rb | 6 |
1 files changed, 5 insertions, 1 deletions
diff --git a/app/models/commit_status.rb b/app/models/commit_status.rb index 535db26240a..2d185c28809 100644 --- a/app/models/commit_status.rb +++ b/app/models/commit_status.rb @@ -16,7 +16,11 @@ class CommitStatus < ActiveRecord::Base alias_attribute :author, :user - scope :latest, -> { where(id: unscope(:select).select('max(id)').group(:name, :commit_id)) } + scope :latest, -> do + max_id = unscope(:select).select("max(#{quoted_table_name}.id)") + + where(id: max_id.group(:name, :commit_id)) + end scope :retried, -> { where.not(id: latest) } scope :ordered, -> { order(:name) } scope :ignored, -> { where(allow_failure: true, status: [:failed, :canceled]) } |