From 1a50be823186082e8b5a29d8e9ea3a289318d9c1 Mon Sep 17 00:00:00 2001 From: Tatiana Soukiassian Date: Sat, 13 Dec 2014 15:34:41 +0000 Subject: 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. --- actionpack/lib/action_dispatch/routing/route_set.rb | 10 ++++++++-- 1 file changed, 8 insertions(+), 2 deletions(-) (limited to 'actionpack/lib/action_dispatch/routing/route_set.rb') 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 -- cgit v1.2.3