Commit f081bd7b authored by Timothy Andrew's avatar Timothy Andrew Committed by Alfredo Sumaran

Allow destroying protected branch access levels from the `update` action.

- Using the `allow_destroy` option for `accepts_nested_attributes_for`
parent 5d24ce8b
...@@ -60,8 +60,8 @@ class Projects::ProtectedBranchesController < Projects::ApplicationController ...@@ -60,8 +60,8 @@ class Projects::ProtectedBranchesController < Projects::ApplicationController
def protected_branch_params def protected_branch_params
params.require(:protected_branch).permit(:name, params.require(:protected_branch).permit(:name,
merge_access_levels_attributes: [:access_level, :id, :user_id], merge_access_levels_attributes: [:access_level, :id, :user_id, :_destroy],
push_access_levels_attributes: [:access_level, :id, :user_id]) push_access_levels_attributes: [:access_level, :id, :user_id, :_destroy])
end end
def load_protected_branches def load_protected_branches
......
...@@ -11,8 +11,8 @@ class ProtectedBranch < ActiveRecord::Base ...@@ -11,8 +11,8 @@ class ProtectedBranch < ActiveRecord::Base
validates_length_of :merge_access_levels, minimum: 0 validates_length_of :merge_access_levels, minimum: 0
validates_length_of :push_access_levels, minimum: 0 validates_length_of :push_access_levels, minimum: 0
accepts_nested_attributes_for :push_access_levels accepts_nested_attributes_for :push_access_levels, allow_destroy: true
accepts_nested_attributes_for :merge_access_levels accepts_nested_attributes_for :merge_access_levels, allow_destroy: true
# Returns all merge access levels (for protected branches in scope) that grant merge # Returns all merge access levels (for protected branches in scope) that grant merge
# access to the given user. # access to the given user.
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment