summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorGrzegorz Bizon <grzesiek.bizon@gmail.com>2016-04-18 11:17:55 +0200
committerGrzegorz Bizon <grzesiek.bizon@gmail.com>2016-04-19 12:15:56 +0200
commitd177abb32b0b31ec27c51d0eb42e1ea131d64a03 (patch)
tree33b3824fa35b6bb15579c96272000e1a0c9f031f
parentf2e3868124c1b0acef4eb57ffc42577b74fab334 (diff)
downloadgitlab-ce-d177abb32b0b31ec27c51d0eb42e1ea131d64a03.tar.gz
Refactor method that shares project with a group
-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