Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP

Loading…

Makes permit! recursive #41

Merged
merged 2 commits into from

2 participants

@bloudermilk

As per @dhh's comments in #31, this PR makes ActionController::Parameter#permit! recursive. Looking forward to your notes.

@dhh dhh merged commit 5536c0c into rails:master
@dhh
Owner
dhh commented

Need this applied to rails/master itself too. Can you drum up a PR for that?

@bloudermilk

@dhh would be happy to!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
This page is out of date. Refresh to see the latest.
View
5 lib/action_controller/parameters.rb
@@ -22,6 +22,11 @@ def initialize(attributes = nil)
end
def permit!
+ each_pair do |key, value|
+ convert_hashes_to_parameters(key, value)
+ self[key].permit! if self[key].respond_to? :permit!
+ end
+
@permitted = true
self
end
View
7 test/parameters_taint_test.rb
@@ -58,4 +58,11 @@ class ParametersTaintTest < ActiveSupport::TestCase
@params.permit!
assert_equal @params.permitted?, @params.dup.permitted?
end
+
+ test "permit is recursive" do
+ @params.permit!
+ assert @params.permitted?
+ assert @params[:person].permitted?
+ assert @params[:person][:name].permitted?
+ end
end
Something went wrong with that request. Please try again.