diff --git a/actionpack/lib/action_dispatch/routing/route_set.rb b/actionpack/lib/action_dispatch/routing/route_set.rb index eae3e35ba1f21462798e68e29715b9125335df0f..2bf732ac26b3e9a31415052279b10b4637256c0b 100644 --- a/actionpack/lib/action_dispatch/routing/route_set.rb +++ b/actionpack/lib/action_dispatch/routing/route_set.rb @@ -163,7 +163,8 @@ class OptimizedUrlHelper < UrlHelper def initialize(route, options) super - @arg_size = @route.required_parts.size + @path_parts = @route.required_parts + @arg_size = @path_parts.size end def call(t, args) @@ -185,7 +186,7 @@ def optimized_helper(args) true end - @route.required_parts.each_with_index do |part, i| + @path_parts.each_with_index do |part, i| # Replace each route parameter # e.g. :id for regular parameter or *path for globbing # with ruby string interpolation code