From 5476a6a6c7e3be5722481a2bd3b60322f1672c1e Mon Sep 17 00:00:00 2001 From: Michael Koziarski Date: Sat, 14 Jul 2007 09:28:56 +0000 Subject: Make :trailing_slash work with query parameters for url_for. Closes #4004 [nov] git-svn-id: http://svn-commit.rubyonrails.org/rails/trunk@7186 5ecf4fe2-1ee6-0310-87b1-e25e094e27de --- actionpack/lib/action_controller/url_rewriter.rb | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) (limited to 'actionpack/lib') diff --git a/actionpack/lib/action_controller/url_rewriter.rb b/actionpack/lib/action_controller/url_rewriter.rb index 384c818254..3b2af2e1c2 100644 --- a/actionpack/lib/action_controller/url_rewriter.rb +++ b/actionpack/lib/action_controller/url_rewriter.rb @@ -89,9 +89,9 @@ module ActionController rewritten_url << ":#{options.delete(:port)}" if options.key?(:port) end + path = rewrite_path(options) rewritten_url << @request.relative_url_root.to_s unless options[:skip_relative_url_root] - rewritten_url << rewrite_path(options) - rewritten_url << '/' if options[:trailing_slash] + rewritten_url << (options[:trailing_slash] ? path.sub(/\?|\z/) { "/" + $& } : path) rewritten_url << "##{options[:anchor]}" if options[:anchor] rewritten_url @@ -121,4 +121,4 @@ module ActionController end end end -end \ No newline at end of file +end -- cgit v1.2.3