Welcome to mirror list, hosted at ThFree Co, Russian Federation.

gitlab.com/gitlab-org/gitlab-foss.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
path: root/app
diff options
context:
space:
mode:
authorKamil Trzciński <ayufan@ayufan.eu>2016-10-20 20:55:38 +0300
committerKamil Trzciński <ayufan@ayufan.eu>2016-10-20 20:55:38 +0300
commita7307c8a9abd8b41c4fafe6cf43decc8506e6da7 (patch)
tree59946bb80d77064773c1bf676a599b01db3bebc0 /app
parentde12e6f0c4689155d049b56d97625627379a40b7 (diff)
parent55365d368a069d6598f58d71d8891d6c8f06ea66 (diff)
Merge branch 'zj-use-iid-deployment-refs' into 'master'
Use iid deployment refs This fixes the 404, because `find_by` will return nil instead of throwing an error. See merge request !7021
Diffstat (limited to 'app')
-rw-r--r--app/models/deployment.rb4
-rw-r--r--app/models/environment.rb4
2 files changed, 4 insertions, 4 deletions
diff --git a/app/models/deployment.rb b/app/models/deployment.rb
index 1f8c5fb3d85..91d85c2279b 100644
--- a/app/models/deployment.rb
+++ b/app/models/deployment.rb
@@ -11,7 +11,7 @@ class Deployment < ActiveRecord::Base
delegate :name, to: :environment, prefix: true
- after_save :create_ref
+ after_create :create_ref
def commit
project.commit(sha)
@@ -102,6 +102,6 @@ class Deployment < ActiveRecord::Base
private
def ref_path
- File.join(environment.ref_path, 'deployments', id.to_s)
+ File.join(environment.ref_path, 'deployments', iid.to_s)
end
end
diff --git a/app/models/environment.rb b/app/models/environment.rb
index d575f1dc73a..73f415c0ef0 100644
--- a/app/models/environment.rb
+++ b/app/models/environment.rb
@@ -71,8 +71,8 @@ class Environment < ActiveRecord::Base
return nil unless ref
- deployment_id = ref.split('/').last
- deployments.find(deployment_id)
+ deployment_iid = ref.split('/').last
+ deployments.find_by(iid: deployment_iid)
end
def ref_path