From 42d6700b7cfe9e6beb935d31597ad8b3762d9ee2 Mon Sep 17 00:00:00 2001 From: Aaron Patterson Date: Thu, 1 May 2014 14:36:46 -0700 Subject: stop popping in build_named_route_call --- actionpack/lib/action_dispatch/routing/polymorphic_routes.rb | 7 +++---- 1 file changed, 3 insertions(+), 4 deletions(-) diff --git a/actionpack/lib/action_dispatch/routing/polymorphic_routes.rb b/actionpack/lib/action_dispatch/routing/polymorphic_routes.rb index 4d83b48ad1..afd971e7a5 100644 --- a/actionpack/lib/action_dispatch/routing/polymorphic_routes.rb +++ b/actionpack/lib/action_dispatch/routing/polymorphic_routes.rb @@ -114,13 +114,13 @@ module ActionDispatch record_or_hash_or_array = record_or_hash_or_array[0] if record_or_hash_or_array.size == 1 end - record_list = extract_record_list(record_or_hash_or_array) - record = convert_to_model(record_list.last) - 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) + inflection = if options[:action] && options[:action].to_s == "new" args.pop :singular @@ -195,7 +195,6 @@ module ActionDispatch end def build_named_route_call(records, record, inflection, options) - records.pop route = records.map { |parent| build_route_part parent, :singular } route << build_route_part(record, inflection) -- cgit v1.2.3