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

Inherits:
Object
  • Object
show all
Defined in:
lib/action_dispatch/request/utils.rb

Overview

:nodoc:

Class Method Summary collapse

Class Method Details

.action_encoding_template(request, controller, action) ⇒ Object

:nodoc:



94
95
96
97
98
# File 'lib/action_dispatch/request/utils.rb', line 94

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

.encode(request, params, controller, action) ⇒ Object



82
83
84
85
86
87
88
89
90
91
92
# File 'lib/action_dispatch/request/utils.rb', line 82

def self.encode(request, params, controller, action)
  return params unless controller && controller.valid_encoding? && encoding_template = action_encoding_template(request, controller, action)
  params.except(:controller, :action).each do |key, value|
    ActionDispatch::Request::Utils.each_param_value(value) do |param|
      if encoding_template[key.to_s]
        param.force_encoding(encoding_template[key.to_s])
      end
    end
  end
  params
end