diff options
author | Aaron Patterson <aaron.patterson@gmail.com> | 2014-05-20 15:06:35 -0700 |
---|---|---|
committer | Aaron Patterson <aaron.patterson@gmail.com> | 2014-05-20 15:09:04 -0700 |
commit | 5e181ed0aeb829510f1c739a7dcc8328d2675258 (patch) | |
tree | efc2143a4bbbdcd095a9087f4f0ec9c044815b6f /actionpack/lib/action_dispatch | |
parent | 84bf3a08150e9e10a29282a7a671a052f00bcd31 (diff) | |
download | rails-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.rb | 21 |
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) |