123456789_123456789_123456789_123456789_123456789_

Class: ActionDispatch::Request::Utils::CustomParamEncoder

Do not use. This class is for internal use only.
Relationships & Source Files
Inherits: Object
Defined in: actionpack/lib/action_dispatch/request/utils.rb

Class Method Summary

Class Method Details

.action_encoding_template(request, controller, action)

[ GitHub ]

  
# File 'actionpack/lib/action_dispatch/request/utils.rb', line 106

def self.action_encoding_template(request, controller, action) # :nodoc:
  controller && controller.valid_encoding? &&
    request.controller_class_for(controller).action_encoding_template(action)
rescue MissingController
  nil
end

.encode(request, params, controller, action)

[ GitHub ]

  
# File 'actionpack/lib/action_dispatch/request/utils.rb', line 101

def self.encode(request, params, controller, action)
  encoding_template = action_encoding_template(request, controller, action)
  encode_for_template(params, encoding_template)
end

.encode_for_template(params, encoding_template)

[ GitHub ]

  
# File 'actionpack/lib/action_dispatch/request/utils.rb', line 86

def self.encode_for_template(params, encoding_template)
  return params unless encoding_template
  params.except(:controller, :action).each do |key, value|
    ActionDispatch::Request::Utils.each_param_value(value) do |param|
      # If `param` is frozen, it comes from the router defaults
      next if param.frozen?

      if encoding_template[key.to_s]
        param.force_encoding(encoding_template[key.to_s])
      end
    end
  end
  params
end