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

Parameter deletion within an Array #224

Open
jonesdeini opened this issue May 3, 2015 · 0 comments
Open

Parameter deletion within an Array #224

jonesdeini opened this issue May 3, 2015 · 0 comments

Comments

@jonesdeini
Copy link

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

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant