Skip to content

Instantly share code, notes, and snippets.

@Tyralion
Created August 31, 2016 11:43
Show Gist options
  • Save Tyralion/227ca35b7fbf98547e923e2a4571fb5b to your computer and use it in GitHub Desktop.
Save Tyralion/227ca35b7fbf98547e923e2a4571fb5b to your computer and use it in GitHub Desktop.
module ActionDispatchPatch
module Utils
def check_param_encoding(params)
case params
when Array
params.each { |element| check_param_encoding(element) }
when Hash
params.each_value { |value| check_param_encoding(value) }
when String
params.try_decode!
end
end # check_param_encoding
end # Utils
module Request
private
def check_method(name)
HTTP_METHOD_LOOKUP[name].nil? ? 'GET' : name
end # check_method
end # Request
end # ActionDispatchPatch
ActionDispatch::Request::Utils.extend(ActionDispatchPatch::Utils)
ActionDispatch::Request.include(ActionDispatchPatch::Request)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment