提交 540a0ba8 编写于 作者: R Rafael Mendonça França

Merge pull request #16013 from tgxworld/remove_symbolized_path_parameters

Remove symbolized_path_parameters.
......@@ -233,7 +233,6 @@ def recycle!
@formats = nil
@env.delete_if { |k, v| k =~ /^(action_dispatch|rack)\.request/ }
@env.delete_if { |k, v| k =~ /^action_dispatch\.rescue/ }
@symbolized_path_params = nil
@method = @request_method = nil
@fullpath = @ip = @remote_ip = @protocol = nil
@env['action_dispatch.request.query_parameters'] = {}
......
require 'active_support/core_ext/hash/keys'
require 'active_support/core_ext/hash/indifferent_access'
require 'active_support/deprecation'
module ActionDispatch
module Http
......@@ -24,8 +25,10 @@ def path_parameters=(parameters) #:nodoc:
@env[PARAMETERS_KEY] = parameters
end
# The same as <tt>path_parameters</tt> with explicitly symbolized keys.
def symbolized_path_parameters
ActiveSupport::Deprecation.warn(
"`symbolized_path_parameters` is deprecated. Please use `path_parameters`"
)
path_parameters
end
......@@ -33,8 +36,6 @@ def symbolized_path_parameters
# Returned hash keys are strings:
#
# {'action' => 'my_action', 'controller' => 'my_controller'}
#
# See <tt>symbolized_path_parameters</tt> for symbolized keys.
def path_parameters
@env[PARAMETERS_KEY] ||= {}
end
......
......@@ -39,7 +39,7 @@ def path=(path)
end
def action=(action_name)
path_parameters["action"] = action_name.to_s
path_parameters[:action] = action_name.to_s
end
def if_modified_since=(last_modified)
......
......@@ -737,12 +737,12 @@ def test_filtered_parameters_reset_between_requests
assert_equal "baz", @request.filtered_parameters[:foo]
end
def test_symbolized_path_params_reset_after_request
def test_path_params_reset_after_request
get :test_params, :id => "foo"
assert_equal "foo", @request.symbolized_path_parameters[:id]
assert_equal "foo", @request.path_parameters[:id]
@request.recycle!
get :test_params
assert_nil @request.symbolized_path_parameters[:id]
assert_nil @request.path_parameters[:id]
end
def test_request_protocol_is_reset_after_request
......
......@@ -2831,7 +2831,7 @@ def test_redirect_https
end
end
def test_symbolized_path_parameters_is_not_stale
def test_path_parameters_is_not_stale
draw do
scope '/countries/:country', :constraints => lambda { |params, req| %w(all France).include?(params[:country]) } do
get '/', :to => 'countries#index'
......@@ -3148,7 +3148,7 @@ def test_multiple_positional_args_with_the_same_name
get '/downloads/1/1.tar'
assert_equal 'downloads#show', @response.body
assert_equal expected_params, @request.symbolized_path_parameters
assert_equal expected_params, @request.path_parameters
assert_equal '/downloads/1/1.tar', download_path('1')
assert_equal '/downloads/1/1.tar', download_path('1', '1')
end
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册