Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP
Browse files

mutate the path string to avoid object allocations

  • Loading branch information...
commit b610104e5ce9c148e67cf7f73c8c3e644b2077f9 1 parent 5f49da8
@tenderlove tenderlove authored
Showing with 4 additions and 4 deletions.
  1. +4 −4 actionpack/lib/action_dispatch/http/url.rb
View
8 actionpack/lib/action_dispatch/http/url.rb
@@ -45,14 +45,14 @@ def url_for(options)
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] :
Please sign in to comment.
Something went wrong with that request. Please try again.