diff options
author | Jonathan del Strother <jdelStrother@gmail.com> | 2017-06-22 13:10:21 +0100 |
---|---|---|
committer | Jonathan del Strother <jdelStrother@gmail.com> | 2017-06-23 09:42:57 +0100 |
commit | 2c0300389c3f6be00bf6c6b806332808a9400429 (patch) | |
tree | 8c00959f2de3c8bb380f418e36530f01337b1a17 /actionpack/lib/action_dispatch/routing | |
parent | 5de611afe63f9a30360d49db90e864d1d29dc283 (diff) | |
download | rails-2c0300389c3f6be00bf6c6b806332808a9400429.tar.gz rails-2c0300389c3f6be00bf6c6b806332808a9400429.tar.bz2 rails-2c0300389c3f6be00bf6c6b806332808a9400429.zip |
Fix missing formats in route-set URLs
Before this change, handle_positional_args would end up mutating @segment_keys
if inner_options included path components. Subsequent calls would then
be missing the implicit path components.
eg:
user_path(1, :json) # => "/users/1.json" (correct)
user_path(1, format: :json) # => "/users/1.json" (correct, but @segment_keys was mutated)
user_path(1, :json) # => "/users/1" (oh no!)
Diffstat (limited to 'actionpack/lib/action_dispatch/routing')
-rw-r--r-- | actionpack/lib/action_dispatch/routing/route_set.rb | 2 |
1 files changed, 2 insertions, 0 deletions
diff --git a/actionpack/lib/action_dispatch/routing/route_set.rb b/actionpack/lib/action_dispatch/routing/route_set.rb index e1f9fc9ecc..68bd6d806b 100644 --- a/actionpack/lib/action_dispatch/routing/route_set.rb +++ b/actionpack/lib/action_dispatch/routing/route_set.rb @@ -279,6 +279,8 @@ module ActionDispatch if args.size < path_params_size path_params -= controller_options.keys path_params -= result.keys + else + path_params = path_params.dup end inner_options.each_key do |key| path_params.delete(key) |