diff options
Diffstat (limited to 'actionpack/lib/action_controller/request.rb')
-rwxr-xr-x | actionpack/lib/action_controller/request.rb | 15 |
1 files changed, 13 insertions, 2 deletions
diff --git a/actionpack/lib/action_controller/request.rb b/actionpack/lib/action_controller/request.rb index 429b3b9017..6e73a69ed7 100755 --- a/actionpack/lib/action_controller/request.rb +++ b/actionpack/lib/action_controller/request.rb @@ -84,9 +84,20 @@ module ActionController def ssl? protocol == 'https://' end - + + # returns the interpreted path to requested resource after + # all the installation directory of this application was taken into account def path - request_uri ? request_uri.split('?').first : '' + path = request_uri ? request_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] + end + + # returns the path minus the web server relative + # installation directory + def relative_url_root + File.dirname(env["SCRIPT_NAME"].to_s).gsub /(^\.$|^\/$)/, '' end def port |