summaryrefslogtreecommitdiff
path: root/app/models/environment.rb
diff options
context:
space:
mode:
authorZ.J. van de Weg <zegerjan@gitlab.com>2016-10-05 13:52:15 +0200
committerZ.J. van de Weg <zegerjan@gitlab.com>2016-10-14 11:07:01 +0200
commitfa58068b2894b900d4b2519825411e0710557fc6 (patch)
treeab82d1f4e9bbe4162c74ae7c9c1f4d8117bf546a /app/models/environment.rb
parent8a1064d76252e16b64b6e4f03d819b6dc20e1d6d (diff)
downloadgitlab-ce-fa58068b2894b900d4b2519825411e0710557fc6.tar.gz
Refactor ci_status on MergeRequestController
Diffstat (limited to 'app/models/environment.rb')
-rw-r--r--app/models/environment.rb5
1 files changed, 3 insertions, 2 deletions
diff --git a/app/models/environment.rb b/app/models/environment.rb
index 1c7d06906f3..c6cae81ce6a 100644
--- a/app/models/environment.rb
+++ b/app/models/environment.rb
@@ -48,12 +48,13 @@ class Environment < ActiveRecord::Base
self.name == "production"
end
- def deployment_id_for(commit)
+ def first_deployment_for(commit)
ref = project.repository.ref_name_for_sha(ref_path, commit.sha)
return nil unless ref
- ref.split('/').last.to_i
+ deployment_id = ref.split('/').last.to_i
+ deployments.find(deployment_id)
end
def ref_path