diff options
author | Aaron Patterson <aaron.patterson@gmail.com> | 2014-05-20 15:43:46 -0700 |
---|---|---|
committer | Aaron Patterson <aaron.patterson@gmail.com> | 2014-05-20 15:43:46 -0700 |
commit | ba487b9bb0fc4fcb02fdf2644cb908cc38263c18 (patch) | |
tree | 6343a652363b75eda8604ffe3ed2b906adb427a8 /actionpack/lib | |
parent | b610104e5ce9c148e67cf7f73c8c3e644b2077f9 (diff) | |
download | rails-ba487b9bb0fc4fcb02fdf2644cb908cc38263c18.tar.gz rails-ba487b9bb0fc4fcb02fdf2644cb908cc38263c18.tar.bz2 rails-ba487b9bb0fc4fcb02fdf2644cb908cc38263c18.zip |
fewer string allocations per url_for
Diffstat (limited to 'actionpack/lib')
-rw-r--r-- | actionpack/lib/action_dispatch/http/url.rb | 12 |
1 files changed, 5 insertions, 7 deletions
diff --git a/actionpack/lib/action_dispatch/http/url.rb b/actionpack/lib/action_dispatch/http/url.rb index 7ca1636780..a6c17f50a5 100644 --- a/actionpack/lib/action_dispatch/http/url.rb +++ b/actionpack/lib/action_dispatch/http/url.rb @@ -37,12 +37,6 @@ module ActionDispatch path = options[:script_name].to_s.chomp("/") path << options[:path].to_s - if options[:only_path] - result = '' - else - result = build_host_url(options) - end - if options[:trailing_slash] if path.include?('?') path.sub!(/\?/, '/\&') @@ -51,7 +45,11 @@ module ActionDispatch end end - result << path + result = path + + unless options[:only_path] + result.prepend build_host_url(options) + end if options.key? :params params = options[:params].is_a?(Hash) ? |