diff options
author | Lin Jen-Shin <godfat@godfat.org> | 2016-06-14 18:11:43 +0300 |
---|---|---|
committer | Lin Jen-Shin <godfat@godfat.org> | 2016-06-14 18:11:43 +0300 |
commit | 9cf45b058627f039040165519de9c2074dda141f (patch) | |
tree | c7bc772eba297a77522eed07a9a8e1bc5ebe5722 /lib/api/runners.rb | |
parent | 6c500034f4e626f28fa0a47534c24f7181131b43 (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 'lib/api/runners.rb')
-rw-r--r-- | lib/api/runners.rb | 4 |
1 files changed, 3 insertions, 1 deletions
diff --git a/lib/api/runners.rb b/lib/api/runners.rb index 2c2610fc2e7..ecc8f2fc5a2 100644 --- a/lib/api/runners.rb +++ b/lib/api/runners.rb @@ -97,7 +97,9 @@ module API runner = get_runner(params[:runner_id]) authenticate_enable_runner!(runner) - if runner.assign_to(user_project) + runner_project = runner.assign_to(user_project) + + if runner_project.persisted? present runner, with: Entities::Runner else conflict!("Runner was already enabled for this project") |