From c337e8707cd404ff2d8a69a6fd90b81cd7f7684b Mon Sep 17 00:00:00 2001 From: Aaron Patterson Date: Fri, 25 Jan 2013 10:39:23 -0800 Subject: [PATCH] cache path parts in the instance --- actionpack/lib/action_dispatch/routing/route_set.rb | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/actionpack/lib/action_dispatch/routing/route_set.rb b/actionpack/lib/action_dispatch/routing/route_set.rb index eae3e35ba1..2bf732ac26 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 -- GitLab