Permalink
Browse files

Simplify Request#path

  • Loading branch information...
1 parent 4fabc9b commit eb5e6fe713756b36ee6df9b04f28cfb8bae60dbc @jeremy jeremy committed Dec 1, 2008
Showing with 3 additions and 5 deletions.
  1. +3 −5 actionpack/lib/action_controller/request.rb
@@ -369,11 +369,9 @@ def request_uri
# Returns the interpreted \path to requested resource after all the installation
# directory of this application was taken into account.
def path
- path = (uri = request_uri) ? uri.split('?').first.to_s : ''
-
- # Cut off the path to the installation directory if given
- path.sub!(%r/^#{ActionController::Base.relative_url_root}/, '')
- path || ''
+ path = request_uri.to_s[/\A[^\?]*/]
+ path.sub!(/\A#{ActionController::Base.relative_url_root}/, '')
+ path
end
memoize :path

0 comments on commit eb5e6fe

Please sign in to comment.