diff options
author | David Heinemeier Hansson <david@loudthinking.com> | 2005-05-19 18:55:50 +0000 |
---|---|---|
committer | David Heinemeier Hansson <david@loudthinking.com> | 2005-05-19 18:55:50 +0000 |
commit | caf6ff6a2f7537254b0c88f516e9b0e3347a82b3 (patch) | |
tree | ec9bef0435023f94c455a68342a6deab7fa00e3b /actionpack | |
parent | 3a057ea4ac9eed5b8ef8aaa9722b8eace1260306 (diff) | |
download | rails-caf6ff6a2f7537254b0c88f516e9b0e3347a82b3.tar.gz rails-caf6ff6a2f7537254b0c88f516e9b0e3347a82b3.tar.bz2 rails-caf6ff6a2f7537254b0c88f516e9b0e3347a82b3.zip |
Cache relative_url_root and optimize path #1232 [skaen]
git-svn-id: http://svn-commit.rubyonrails.org/rails/trunk@1325 5ecf4fe2-1ee6-0310-87b1-e25e094e27de
Diffstat (limited to 'actionpack')
-rwxr-xr-x | actionpack/lib/action_controller/request.rb | 5 |
1 files changed, 3 insertions, 2 deletions
diff --git a/actionpack/lib/action_controller/request.rb b/actionpack/lib/action_controller/request.rb index 31d0fb1539..02682b57cf 100755 --- a/actionpack/lib/action_controller/request.rb +++ b/actionpack/lib/action_controller/request.rb @@ -117,7 +117,8 @@ module ActionController # returns the interpreted path to requested resource after # all the installation directory of this application was taken into account def path - path = request_uri ? request_uri.split('?').first : '' + uri = request_uri + path = uri ? uri.split('?').first : '' # cut off the part of the url which leads to the installation directory of this app path[relative_url_root.length..-1] @@ -126,7 +127,7 @@ module ActionController # returns the path minus the web server relative # installation directory def relative_url_root - File.dirname(env["SCRIPT_NAME"].to_s).gsub /(^\.$|^\/$)/, '' + @@relative_url_root ||= File.dirname(env["SCRIPT_NAME"].to_s).gsub /(^\.$|^\/$)/, '' end def port |