From 95c76a7cf390d5c01207757b7b2487e289c41b3d Mon Sep 17 00:00:00 2001 From: Aaron Patterson Date: Sun, 1 Mar 2015 16:13:02 -0800 Subject: drop allocations for string and class polymorphic routes --- actionpack/lib/action_dispatch/routing/polymorphic_routes.rb | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) (limited to 'actionpack/lib/action_dispatch/routing') diff --git a/actionpack/lib/action_dispatch/routing/polymorphic_routes.rb b/actionpack/lib/action_dispatch/routing/polymorphic_routes.rb index f2ce175cac..1a7944780b 100644 --- a/actionpack/lib/action_dispatch/routing/polymorphic_routes.rb +++ b/actionpack/lib/action_dispatch/routing/polymorphic_routes.rb @@ -254,7 +254,7 @@ module ActionDispatch @key_strategy.call model.model_name end - named_route = "#{prefix}#{name}_#{suffix}" + named_route = get_method_for_string name [named_route, args] end @@ -309,11 +309,11 @@ module ActionDispatch def get_method_for_class(klass) name = @key_strategy.call klass.model_name - prefix + "#{name}_#{suffix}" + get_method_for_string name end def get_method_for_string(str) - prefix + "#{str}_#{suffix}" + "#{prefix}#{str}_#{suffix}" end [nil, 'new', 'edit'].each do |action| -- cgit v1.2.3