Permalink
Browse files

Allow #permit to take its list of permitted parameters as an array

  • Loading branch information...
1 parent 4b20cd9 commit 954c350daf435017e34327c83d877377c3f83778 @dhh dhh committed Oct 31, 2012
@@ -196,7 +196,7 @@ def require(key)
def permit(*filters)
params = self.class.new
- filters.each do |filter|
+ filters.flatten.each do |filter|
case filter
when Symbol, String then
if has_key?(filter)
@@ -1,4 +1,5 @@
require 'abstract_unit'
+require 'debugger'
require 'action_controller/metal/strong_parameters'
class ParametersPermitTest < ActiveSupport::TestCase
@@ -77,4 +78,8 @@ class ParametersPermitTest < ActiveSupport::TestCase
ActionController::Parameters.permit_all_parameters = false
end
end
+
+ test "permitting parameters as an array" do
+ assert_equal "32", @params[:person].permit([ :age ])[:age]
+ end
end

0 comments on commit 954c350

Please sign in to comment.