diff options
author | Lin Jen-Shin <godfat@godfat.org> | 2016-06-14 23:11:43 +0800 |
---|---|---|
committer | Lin Jen-Shin <godfat@godfat.org> | 2016-06-14 23:11:43 +0800 |
commit | 9cf45b058627f039040165519de9c2074dda141f (patch) | |
tree | c7bc772eba297a77522eed07a9a8e1bc5ebe5722 /app/controllers/admin | |
parent | 6c500034f4e626f28fa0a47534c24f7181131b43 (diff) | |
download | gitlab-ce-9cf45b058627f039040165519de9c2074dda141f.tar.gz |
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/admin')
-rw-r--r-- | app/controllers/admin/runner_projects_controller.rb | 4 |
1 files changed, 3 insertions, 1 deletions
diff --git a/app/controllers/admin/runner_projects_controller.rb b/app/controllers/admin/runner_projects_controller.rb index 29307aeab6d..5383afdbd20 100644 --- a/app/controllers/admin/runner_projects_controller.rb +++ b/app/controllers/admin/runner_projects_controller.rb @@ -11,7 +11,9 @@ class Admin::RunnerProjectsController < Admin::ApplicationController return head(403) if runner.is_shared? || runner.is_locked? - if @runner.assign_to(@project, current_user) + runner_project = @runner.assign_to(@project, current_user) + + if runner_project.persisted? redirect_to admin_runner_path(@runner) else redirect_to admin_runner_path(@runner), alert: 'Failed adding runner to project' |