diff options
author | David Heinemeier Hansson <david@loudthinking.com> | 2005-07-23 09:00:05 +0000 |
---|---|---|
committer | David Heinemeier Hansson <david@loudthinking.com> | 2005-07-23 09:00:05 +0000 |
commit | b366dbd952417a610913e05ad58024b7da03fdb8 (patch) | |
tree | 0ca8e594c78a92cec73ca0abec49fec90d8373e3 /actionpack/lib/action_controller/url_rewriter.rb | |
parent | d1725929852ab9da48f7ff7c4fa7f401ac55c331 (diff) | |
download | rails-b366dbd952417a610913e05ad58024b7da03fdb8.tar.gz rails-b366dbd952417a610913e05ad58024b7da03fdb8.tar.bz2 rails-b366dbd952417a610913e05ad58024b7da03fdb8.zip |
Improved performance with 5-30% through a series of Action Pack optimizations #1811 [Stefan Kaes]
git-svn-id: http://svn-commit.rubyonrails.org/rails/trunk@1905 5ecf4fe2-1ee6-0310-87b1-e25e094e27de
Diffstat (limited to 'actionpack/lib/action_controller/url_rewriter.rb')
-rw-r--r-- | actionpack/lib/action_controller/url_rewriter.rb | 13 |
1 files changed, 9 insertions, 4 deletions
diff --git a/actionpack/lib/action_controller/url_rewriter.rb b/actionpack/lib/action_controller/url_rewriter.rb index ecbc6851f4..7d66cf1ced 100644 --- a/actionpack/lib/action_controller/url_rewriter.rb +++ b/actionpack/lib/action_controller/url_rewriter.rb @@ -20,8 +20,10 @@ module ActionController private def rewrite_url(path, options) rewritten_url = "" - rewritten_url << (options[:protocol] || @request.protocol) unless options[:only_path] - rewritten_url << (options[:host] || @request.host_with_port) unless options[:only_path] + unless options[:only_path] + rewritten_url << (options[:protocol] || @request.protocol) + rewritten_url << (options[:host] || @request.host_with_port) + end rewritten_url << @request.relative_url_root.to_s unless options[:skip_relative_url_root] rewritten_url << path @@ -53,8 +55,11 @@ module ActionController only_keys.each do |key| value = hash[key] key = CGI.escape key.to_s - key << '[]' if value.class == Array - value = [ value ] unless value.class == Array + if value.class == Array + key << '[]' + else + value = [ value ] + end value.each { |val| elements << "#{key}=#{Routing.extract_parameter_value(val)}" } end |