Permalink
Browse files

fewer hash allocations when calling url_for

  • Loading branch information...
1 parent 84bf3a0 commit 5e181ed0aeb829510f1c739a7dcc8328d2675258 @tenderlove tenderlove committed May 20, 2014
Showing with 12 additions and 9 deletions.
  1. +12 −9 actionpack/lib/action_dispatch/routing/route_set.rb
@@ -673,15 +673,18 @@ def url_for(options)
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)

0 comments on commit 5e181ed

Please sign in to comment.