From f2fa291a63bac8126e61f126d5be5dfed2e4f6e6 Mon Sep 17 00:00:00 2001 From: Aaron Patterson Date: Thu, 1 May 2014 16:12:34 -0700 Subject: only do the Array is_a check once --- actionpack/lib/action_dispatch/routing/polymorphic_routes.rb | 7 +++---- 1 file changed, 3 insertions(+), 4 deletions(-) (limited to 'actionpack/lib/action_dispatch/routing/polymorphic_routes.rb') diff --git a/actionpack/lib/action_dispatch/routing/polymorphic_routes.rb b/actionpack/lib/action_dispatch/routing/polymorphic_routes.rb index c8baf7a324..d8108e5534 100644 --- a/actionpack/lib/action_dispatch/routing/polymorphic_routes.rb +++ b/actionpack/lib/action_dispatch/routing/polymorphic_routes.rb @@ -111,12 +111,11 @@ module ActionDispatch if record_or_hash_or_array.first.is_a?(ActionDispatch::Routing::RoutesProxy) recipient = record_or_hash_or_array.shift end + args = record_or_hash_or_array.dup + else + args = [record_or_hash_or_array] end - args = Array === record_or_hash_or_array ? - record_or_hash_or_array.dup : - [ record_or_hash_or_array ] - record_list = extract_record_list(record_or_hash_or_array) record = convert_to_model(record_list.pop) -- cgit v1.2.3