Skip to content

Commit 9655a9a

Browse files
committed
Remove the permit check for params other than id on a remove request.
Does not currently take any action to store these params, though I think we should do this soon.
1 parent 8638963 commit 9655a9a

2 files changed

Lines changed: 1 addition & 10 deletions

File tree

lib/jsonapi/request.rb

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -604,7 +604,7 @@ def parse_replace_operation(data, keys)
604604
end
605605

606606
def parse_remove_operation(params)
607-
keys = parse_key_array(params.permit(:id)[:id])
607+
keys = parse_key_array(params.require(:id))
608608

609609
keys.each do |key|
610610
@operations.push JSONAPI::RemoveResourceOperation.new(
@@ -613,8 +613,6 @@ def parse_remove_operation(params)
613613
resource_id: key
614614
)
615615
end
616-
rescue ActionController::UnpermittedParameters => e
617-
@errors.concat(JSONAPI::Exceptions::ParametersNotAllowed.new(e.params).errors)
618616
rescue JSONAPI::Exceptions::Error => e
619617
@errors.concat(e.errors)
620618
end

test/controllers/controller_test.rb

Lines changed: 0 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1427,13 +1427,6 @@ def test_delete_multiple_one_does_not_exist
14271427
assert_equal initial_count, Post.count
14281428
end
14291429

1430-
def test_delete_extra_param
1431-
initial_count = Post.count
1432-
delete :destroy, {id: '4', asdfg: 'aaaa'}
1433-
assert_response :bad_request
1434-
assert_equal initial_count, Post.count
1435-
end
1436-
14371430
def test_show_to_one_relationship
14381431
get :show_relationship, {post_id: '1', relationship: 'author'}
14391432
assert_response :success

0 commit comments

Comments
 (0)