aboutsummaryrefslogtreecommitdiffstats
path: root/actionpack/lib/action_dispatch
diff options
context:
space:
mode:
authorAaron Patterson <aaron.patterson@gmail.com>2014-05-20 15:06:35 -0700
committerAaron Patterson <aaron.patterson@gmail.com>2014-05-20 15:09:04 -0700
commit5e181ed0aeb829510f1c739a7dcc8328d2675258 (patch)
treeefc2143a4bbbdcd095a9087f4f0ec9c044815b6f /actionpack/lib/action_dispatch
parent84bf3a08150e9e10a29282a7a671a052f00bcd31 (diff)
downloadrails-5e181ed0aeb829510f1c739a7dcc8328d2675258.tar.gz
rails-5e181ed0aeb829510f1c739a7dcc8328d2675258.tar.bz2
rails-5e181ed0aeb829510f1c739a7dcc8328d2675258.zip
fewer hash allocations when calling url_for
Diffstat (limited to 'actionpack/lib/action_dispatch')
-rw-r--r--actionpack/lib/action_dispatch/routing/route_set.rb21
1 files changed, 12 insertions, 9 deletions
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)