diff options
author | Z.J. van de Weg <zegerjan@gitlab.com> | 2016-10-05 14:52:15 +0300 |
---|---|---|
committer | Z.J. van de Weg <zegerjan@gitlab.com> | 2016-10-14 12:07:01 +0300 |
commit | fa58068b2894b900d4b2519825411e0710557fc6 (patch) | |
tree | ab82d1f4e9bbe4162c74ae7c9c1f4d8117bf546a /app/models/environment.rb | |
parent | 8a1064d76252e16b64b6e4f03d819b6dc20e1d6d (diff) |
Refactor ci_status on MergeRequestController
Diffstat (limited to 'app/models/environment.rb')
-rw-r--r-- | app/models/environment.rb | 5 |
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 |