From a20cd8846397ed01c3a33f59f4f3ba039ec9bc23 Mon Sep 17 00:00:00 2001 From: Coraline Ada Ehmke + Aaron Patterson Date: Mon, 5 May 2014 17:28:43 -0700 Subject: remove unnecessary array allocations --- actionpack/lib/action_dispatch/routing/polymorphic_routes.rb | 6 +----- 1 file changed, 1 insertion(+), 5 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 7b97bf0157..1a4adcbb35 100644 --- a/actionpack/lib/action_dispatch/routing/polymorphic_routes.rb +++ b/actionpack/lib/action_dispatch/routing/polymorphic_routes.rb @@ -114,7 +114,6 @@ module ActionDispatch recipient = record_or_hash_or_array.shift end - args = record_or_hash_or_array.dup record_list = record_or_hash_or_array.dup when Hash unless record_or_hash_or_array[:id] @@ -122,17 +121,14 @@ module ActionDispatch end opts = record_or_hash_or_array.dup.merge!(opts) - args = [opts.delete(:id)] - record_list = args.dup + record_list = [opts.delete(:id)] when nil raise ArgumentError, "Nil location provided. Can't build URI." else - args = [record_or_hash_or_array] record_list = [record_or_hash_or_array] end - record = record_list.pop inflection = lambda { |name| name.singular_route_key } -- cgit v1.2.3