Method: ActionDispatch::Request::Utils::CustomParamEncoder.encode_for_template

Defined in:
actionpack/lib/action_dispatch/request/utils.rb

.encode_for_template(params, encoding_template) ⇒ Object



86
87
88
89
90
91
92
93
94
95
96
97
98
99
# 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