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
diff options
context:
space:
mode:
authorLin Jen-Shin <godfat@godfat.org>2016-06-14 18:11:43 +0300
committerLin Jen-Shin <godfat@godfat.org>2016-06-14 18:11:43 +0300
commit9cf45b058627f039040165519de9c2074dda141f (patch)
treec7bc772eba297a77522eed07a9a8e1bc5ebe5722 /app/controllers/projects/runner_projects_controller.rb
parent6c500034f4e626f28fa0a47534c24f7181131b43 (diff)
Return the association and check it in controller instead:
Feedback: https://gitlab.com/gitlab-org/gitlab-ce/merge_requests/4641#note_12444891
Diffstat (limited to 'app/controllers/projects/runner_projects_controller.rb')
-rw-r--r--app/controllers/projects/runner_projects_controller.rb3
1 files changed, 2 insertions, 1 deletions
diff --git a/app/controllers/projects/runner_projects_controller.rb b/app/controllers/projects/runner_projects_controller.rb
index 4c013303269..2413e583d7b 100644
--- a/app/controllers/projects/runner_projects_controller.rb
+++ b/app/controllers/projects/runner_projects_controller.rb
@@ -10,8 +10,9 @@ class Projects::RunnerProjectsController < Projects::ApplicationController
return head(403) unless current_user.ci_authorized_runners.include?(@runner)
path = runners_path(project)
+ runner_project = @runner.assign_to(project, current_user)
- if @runner.assign_to(project, current_user)
+ if runner_project.persisted?
redirect_to path
else
redirect_to path, alert: 'Failed adding runner to project'