diff options
author | Coraline Ada Ehmke + Aaron Patterson <aaron.patterson@gmail.com> | 2014-05-05 17:28:43 -0700 |
---|---|---|
committer | Aaron Patterson <aaron.patterson@gmail.com> | 2014-05-12 15:54:43 -0700 |
commit | a20cd8846397ed01c3a33f59f4f3ba039ec9bc23 (patch) | |
tree | 0a9c195eb52fa1abca0ba10e8fcb779dad43e55a /actionpack | |
parent | b89dcde82253089da5378272af2fd58c05ec57cd (diff) | |
download | rails-a20cd8846397ed01c3a33f59f4f3ba039ec9bc23.tar.gz rails-a20cd8846397ed01c3a33f59f4f3ba039ec9bc23.tar.bz2 rails-a20cd8846397ed01c3a33f59f4f3ba039ec9bc23.zip |
remove unnecessary array allocations
Diffstat (limited to 'actionpack')
-rw-r--r-- | actionpack/lib/action_dispatch/routing/polymorphic_routes.rb | 6 |
1 files changed, 1 insertions, 5 deletions
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 } |