diff options
author | Aaron Patterson <aaron.patterson@gmail.com> | 2014-05-20 15:33:30 -0700 |
---|---|---|
committer | Aaron Patterson <aaron.patterson@gmail.com> | 2014-05-20 15:33:30 -0700 |
commit | b610104e5ce9c148e67cf7f73c8c3e644b2077f9 (patch) | |
tree | 3cd274c636d96012afbca1a5c9a690c28b965666 | |
parent | 5f49da8c6de50e0b8ab143faa1043a21239f70ec (diff) | |
download | rails-b610104e5ce9c148e67cf7f73c8c3e644b2077f9.tar.gz rails-b610104e5ce9c148e67cf7f73c8c3e644b2077f9.tar.bz2 rails-b610104e5ce9c148e67cf7f73c8c3e644b2077f9.zip |
mutate the path string to avoid object allocations
-rw-r--r-- | actionpack/lib/action_dispatch/http/url.rb | 8 |
1 files changed, 4 insertions, 4 deletions
diff --git a/actionpack/lib/action_dispatch/http/url.rb b/actionpack/lib/action_dispatch/http/url.rb index 86ca909d27..7ca1636780 100644 --- a/actionpack/lib/action_dispatch/http/url.rb +++ b/actionpack/lib/action_dispatch/http/url.rb @@ -45,14 +45,14 @@ module ActionDispatch if options[:trailing_slash] if path.include?('?') - result << path.sub(/\?/, '/\&') + path.sub!(/\?/, '/\&') else - result << path.sub(/[^\/]\z|\A\z/, '\&/') + path.sub!(/[^\/]\z|\A\z/, '\&/') end - else - result << path end + result << path + if options.key? :params params = options[:params].is_a?(Hash) ? options[:params] : |