Hi,
you have a hard time working with ActionController::Parameters if you want to pass the parameter hash to a method that uses keyword arguments:
params = ActionController::Parameters.new(foo: :bar)
#=> {“foo”=>:bar}
def something(foo:)
end
#=> :something
something(params)
#=> ArgumentError: wrong number of arguments (1 for 0)
Reason for this is that HashWithIndefferentAccess defaults to strings for it’s keys, but Ruby requires the keys of a hash to be symbols if you want to pass it to the method as a parameter.
symbolized_params = params.symbolize_keys
#=> {:foo=>:bar}
something(symbolized_keys)
#=> nil
I wonder if it’s possible to change the behavior so that it’s not longer necessary to explicitly symbolize the hash. Would you welcome a pull request that addresses this issue?
Looking forward to your feedback.
Best
Philipp