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:
authorGrzegorz Bizon <grzesiek.bizon@gmail.com>2016-04-18 12:17:55 +0300
committerGrzegorz Bizon <grzesiek.bizon@gmail.com>2016-04-19 13:15:56 +0300
commitd177abb32b0b31ec27c51d0eb42e1ea131d64a03 (patch)
tree33b3824fa35b6bb15579c96272000e1a0c9f031f /app/controllers/projects/group_links_controller.rb
parentf2e3868124c1b0acef4eb57ffc42577b74fab334 (diff)
Refactor method that shares project with a group
Diffstat (limited to 'app/controllers/projects/group_links_controller.rb')
-rw-r--r--app/controllers/projects/group_links_controller.rb7
1 files changed, 3 insertions, 4 deletions
diff --git a/app/controllers/projects/group_links_controller.rb b/app/controllers/projects/group_links_controller.rb
index 92113b9dd87..cd0f081cd7d 100644
--- a/app/controllers/projects/group_links_controller.rb
+++ b/app/controllers/projects/group_links_controller.rb
@@ -10,10 +10,9 @@ class Projects::GroupLinksController < Projects::ApplicationController
group = Group.find(params[:link_group_id])
if can?(current_user, :read_group, group)
- link = project.project_group_links.new
- link.group_id = params[:link_group_id]
- link.group_access = params[:link_group_access]
- link.save
+ project.project_group_links.create(
+ group: group, group_access: params[:link_group_access]
+ )
else
return render_404
end