module ActionController::ParamsWrapper
def _extract_parameters(parameters)
def _extract_parameters(parameters) if include_only = _wrapper_options.include parameters.slice(*include_only) elsif _wrapper_options.exclude exclude = _wrapper_options.exclude + EXCLUDE_PARAMETERS parameters.except(*exclude) else parameters.except(*EXCLUDE_PARAMETERS) end end
def _perform_parameter_wrapping
def _perform_parameter_wrapping wrapped_hash = _wrap_parameters request.request_parameters wrapped_keys = request.request_parameters.keys wrapped_filtered_hash = _wrap_parameters request.filtered_parameters.slice(*wrapped_keys) # This will make the wrapped hash accessible from controller and view. request.parameters.merge! wrapped_hash request.request_parameters.merge! wrapped_hash # This will display the wrapped hash in the log file. request.filtered_parameters.merge! wrapped_filtered_hash end
def _wrap_parameters(parameters)
def _wrap_parameters(parameters) { _wrapper_key => _extract_parameters(parameters) } end
def _wrapper_enabled?
def _wrapper_enabled? return false unless request.has_content_type? ref = request.content_mime_type.ref _wrapper_formats.include?(ref) && _wrapper_key && !request.parameters.key?(_wrapper_key) rescue ActionDispatch::Http::Parameters::ParseError false end
def _wrapper_formats
def _wrapper_formats _wrapper_options.format end
def _wrapper_key
def _wrapper_key _wrapper_options.name end
def process_action(*)
Performs parameters wrapping upon the request. Called automatically
def process_action(*) _perform_parameter_wrapping if _wrapper_enabled? super end