Permalink
Browse files

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
  • Loading branch information...
1 parent 3a057ea commit caf6ff6a2f7537254b0c88f516e9b0e3347a82b3 @dhh dhh committed May 19, 2005
Showing with 3 additions and 2 deletions.
  1. +3 −2 actionpack/lib/action_controller/request.rb
@@ -117,7 +117,8 @@ def ssl?
# 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 @@ def path
# 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

0 comments on commit caf6ff6

Please sign in to comment.