summaryrefslogtreecommitdiff
path: root/app/models/ci
diff options
context:
space:
mode:
authorPhil Hughes <me@iamphill.com>2016-09-02 10:08:22 +0100
committerPhil Hughes <me@iamphill.com>2016-09-02 10:08:22 +0100
commitd2e2da4cb474bdd713eae71df3da644856ce4b81 (patch)
tree370ff22afca4a422577cf277910ab2a6b2990985 /app/models/ci
parent236178c3010cd40709c232b2a3a82f737d8a1eab (diff)
parentfd1741b47970fc52d994367ba38b5d1353d94725 (diff)
downloadgitlab-ce-d2e2da4cb474bdd713eae71df3da644856ce4b81.tar.gz
Merge branch 'master' into revert-c676283b
Diffstat (limited to 'app/models/ci')
-rw-r--r--app/models/ci/pipeline.rb4
1 files changed, 2 insertions, 2 deletions
diff --git a/app/models/ci/pipeline.rb b/app/models/ci/pipeline.rb
index 03812cd195f..bd1737c7587 100644
--- a/app/models/ci/pipeline.rb
+++ b/app/models/ci/pipeline.rb
@@ -65,8 +65,8 @@ module Ci
end
# ref can't be HEAD or SHA, can only be branch/tag name
- scope :latest_successful_for, ->(ref = default_branch) do
- where(ref: ref).success.order(id: :desc).limit(1)
+ def self.latest_successful_for(ref)
+ where(ref: ref).order(id: :desc).success.first
end
def self.truncate_sha(sha)