From 5e181ed0aeb829510f1c739a7dcc8328d2675258 Mon Sep 17 00:00:00 2001 From: Aaron Patterson Date: Tue, 20 May 2014 15:06:35 -0700 Subject: fewer hash allocations when calling url_for --- actionpack/lib/action_dispatch/routing/route_set.rb | 21 ++++++++++++--------- 1 file changed, 12 insertions(+), 9 deletions(-) (limited to 'actionpack/lib/action_dispatch/routing') diff --git a/actionpack/lib/action_dispatch/routing/route_set.rb b/actionpack/lib/action_dispatch/routing/route_set.rb index 04332da5f7..87dfa22207 100644 --- a/actionpack/lib/action_dispatch/routing/route_set.rb +++ b/actionpack/lib/action_dispatch/routing/route_set.rb @@ -673,15 +673,18 @@ module ActionDispatch RESERVED_OPTIONS.each { |ro| path_options.delete ro } path, params = generate(path_options, recall) - params.merge!(options[:params] || {}) - - ActionDispatch::Http::URL.url_for(options.merge!({ - :path => path, - :script_name => script_name, - :params => params, - :user => user, - :password => password - })) + + if options.key? :params + params.merge! options[:params] + end + + options[:path] = path + options[:script_name] = script_name + options[:params] = params + options[:user] = user + options[:password] = password + + ActionDispatch::Http::URL.url_for(options) end def call(env) -- cgit v1.2.3