Skip to content
This repository was archived by the owner on Aug 17, 2017. It is now read-only.
This repository was archived by the owner on Aug 17, 2017. It is now read-only.

Parameter deletion within an Array #224

Open

Description

@jonesdeini

In Rails 4.X this is fixed:

2.2.2 :001 > params = ActionController::Parameters.new
 => {} 
2.2.2 :002 > params[:foo] = ['bar'] 
 => ["bar"] 
2.2.2 :003 > params
 => {"foo"=>["bar"]} 
2.2.2 :004 > params[:foo].delete 'bar'
 => "bar" 
2.2.2 :005 > params
 => {"foo"=>[]} 

Rails 3.1 with strong_parameters

1.9.3-p551 :001 > params = ActionController::Parameters.new
 => {} 
1.9.3-p551 :002 > params[:foo] = ['bar'] 
 => ["bar"] 
1.9.3-p551 :003 > params[:foo].delete 'bar'
 => "bar" 
1.9.3-p551 :004 > params
 => {"foo"=>["bar"]} 
1.9.3-p551 :005 > 

This is caused by this line. As the array returned is no longer the same object (verified by calling #object_id).

I'm currently working on a fix, but I figured I should create an issue so others can know about this.
I have failing test here

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions