diff options
Diffstat (limited to 'actionpack/lib/action_dispatch/routing/polymorphic_routes.rb')
-rw-r--r-- | actionpack/lib/action_dispatch/routing/polymorphic_routes.rb | 7 |
1 files 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) |