diff options
author | Yves Senn <yves.senn@gmail.com> | 2013-01-02 21:11:16 +0100 |
---|---|---|
committer | Yves Senn <yves.senn@gmail.com> | 2013-01-02 21:11:16 +0100 |
commit | 0b2ce7d955041107c70998c0d5b354404b83c74b (patch) | |
tree | 2e6851d5877c1a6912cbc9ff5ba2ba418e1b004f /actionpack/lib/action_dispatch | |
parent | bdaafae550051cddc8db88f464717840d2248111 (diff) | |
download | rails-0b2ce7d955041107c70998c0d5b354404b83c74b.tar.gz rails-0b2ce7d955041107c70998c0d5b354404b83c74b.tar.bz2 rails-0b2ce7d955041107c70998c0d5b354404b83c74b.zip |
do not append a second slash when using
Diffstat (limited to 'actionpack/lib/action_dispatch')
-rw-r--r-- | actionpack/lib/action_dispatch/http/url.rb | 6 |
1 files changed, 5 insertions, 1 deletions
diff --git a/actionpack/lib/action_dispatch/http/url.rb b/actionpack/lib/action_dispatch/http/url.rb index bced7d84c0..43f26d696d 100644 --- a/actionpack/lib/action_dispatch/http/url.rb +++ b/actionpack/lib/action_dispatch/http/url.rb @@ -32,7 +32,11 @@ module ActionDispatch params.reject! { |_,v| v.to_param.nil? } result = build_host_url(options) - result << (options[:trailing_slash] ? path.sub(/\?|\z/) { "/" + $& } : path) + if options[:trailing_slash] && !path.ends_with?('/') + result << path.sub(/(\?|\z)/) { "/" + $& } + else + result << path + end result << "?#{params.to_query}" unless params.empty? result << "##{Journey::Router::Utils.escape_fragment(options[:anchor].to_param.to_s)}" if options[:anchor] result |