diff options
author | Tatiana Soukiassian <binaryberry@gmail.com> | 2014-12-13 15:34:41 +0000 |
---|---|---|
committer | Tatiana Soukiassian <binaryberry@gmail.com> | 2014-12-13 15:42:15 +0000 |
commit | 1a50be823186082e8b5a29d8e9ea3a289318d9c1 (patch) | |
tree | 364f24c8e612f63d6ca1739a38353ff9f1d23455 /actionpack/lib/action_dispatch/routing/route_set.rb | |
parent | 9688270d3e0994ce57de0adbc72b3ab4faaf2c32 (diff) | |
download | rails-1a50be823186082e8b5a29d8e9ea3a289318d9c1.tar.gz rails-1a50be823186082e8b5a29d8e9ea3a289318d9c1.tar.bz2 rails-1a50be823186082e8b5a29d8e9ea3a289318d9c1.zip |
Fix handling of positional url helper arguments when format is false
There is no need to subtract one from the path_params size when there is
no format parameter because it is not present in the path_params array.
Fixes #17819.
Diffstat (limited to 'actionpack/lib/action_dispatch/routing/route_set.rb')
-rw-r--r-- | actionpack/lib/action_dispatch/routing/route_set.rb | 10 |
1 files changed, 8 insertions, 2 deletions
diff --git a/actionpack/lib/action_dispatch/routing/route_set.rb b/actionpack/lib/action_dispatch/routing/route_set.rb index f3144dc2d3..34cd06fd58 100644 --- a/actionpack/lib/action_dispatch/routing/route_set.rb +++ b/actionpack/lib/action_dispatch/routing/route_set.rb @@ -280,9 +280,15 @@ module ActionDispatch end def handle_positional_args(controller_options, inner_options, args, result, path_params) - if args.size > 0 - if args.size < path_params.size - 1 # take format into account + # take format into account + if path_params.include?(:format) + path_params_size = path_params.size - 1 + else + path_params_size = path_params.size + end + + if args.size < path_params_size path_params -= controller_options.keys path_params -= result.keys end |