Skip to content
Browse files

remove unnecessary array allocations

  • Loading branch information...
1 parent b89dcde commit a20cd8846397ed01c3a33f59f4f3ba039ec9bc23 @tenderlove tenderlove committed May 5, 2014
Showing with 1 addition and 5 deletions.
  1. +1 −5 actionpack/lib/action_dispatch/routing/polymorphic_routes.rb
View
6 actionpack/lib/action_dispatch/routing/polymorphic_routes.rb
@@ -114,25 +114,21 @@ def polymorphic_url(record_or_hash_or_array, options = {})
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]
raise ArgumentError, "Nil location provided. Can't build URI."
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 }

0 comments on commit a20cd88

Please sign in to comment.
Something went wrong with that request. Please try again.