diff options
author | Aaron Patterson <aaron.patterson@gmail.com> | 2015-03-01 16:13:02 -0800 |
---|---|---|
committer | Aaron Patterson <aaron.patterson@gmail.com> | 2015-03-01 16:16:15 -0800 |
commit | 95c76a7cf390d5c01207757b7b2487e289c41b3d (patch) | |
tree | 167928b7ba8dbb5a5dfea092ec12691628aee61b /actionpack/lib | |
parent | 1fe5e242ed1cbc4f0e9c549621cce4b6c03d0a3c (diff) | |
download | rails-95c76a7cf390d5c01207757b7b2487e289c41b3d.tar.gz rails-95c76a7cf390d5c01207757b7b2487e289c41b3d.tar.bz2 rails-95c76a7cf390d5c01207757b7b2487e289c41b3d.zip |
drop allocations for string and class polymorphic routes
Diffstat (limited to 'actionpack/lib')
-rw-r--r-- | actionpack/lib/action_dispatch/routing/polymorphic_routes.rb | 6 |
1 files changed, 3 insertions, 3 deletions
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| |