aboutsummaryrefslogtreecommitdiffstats
path: root/actionpack/lib/action_controller/routing_optimisation.rb
diff options
context:
space:
mode:
authorJeremy Kemper <jeremy@bitsweat.net>2007-09-15 20:38:39 +0000
committerJeremy Kemper <jeremy@bitsweat.net>2007-09-15 20:38:39 +0000
commit494d2c631bbfacd6d67c5c502422c2502c2fcd3a (patch)
tree73c1cae29293cd7aad7f6834677806e19a9430ae /actionpack/lib/action_controller/routing_optimisation.rb
parent41ef9211a2f45eee0960f677f853de7ff1ad97c8 (diff)
downloadrails-494d2c631bbfacd6d67c5c502422c2502c2fcd3a.tar.gz
rails-494d2c631bbfacd6d67c5c502422c2502c2fcd3a.tar.bz2
rails-494d2c631bbfacd6d67c5c502422c2502c2fcd3a.zip
root_path returns '/' not ''. Closes #9563.
git-svn-id: http://svn-commit.rubyonrails.org/rails/trunk@7482 5ecf4fe2-1ee6-0310-87b1-e25e094e27de
Diffstat (limited to 'actionpack/lib/action_controller/routing_optimisation.rb')
-rw-r--r--actionpack/lib/action_controller/routing_optimisation.rb11
1 files changed, 5 insertions, 6 deletions
diff --git a/actionpack/lib/action_controller/routing_optimisation.rb b/actionpack/lib/action_controller/routing_optimisation.rb
index 535f1bed63..1b447b17e7 100644
--- a/actionpack/lib/action_controller/routing_optimisation.rb
+++ b/actionpack/lib/action_controller/routing_optimisation.rb
@@ -62,11 +62,10 @@ module ActionController
elements << '#{request.host_with_port}'
end
- # The last entry in route.segments appears to
- # *always* be a 'divider segment' for '/'
- # but we have assertions to ensure that we don't
- # include the trailing slashes, so skip them
- route.segments[0..-2].each do |segment|
+ # The last entry in route.segments appears to # *always* be a
+ # 'divider segment' for '/' but we have assertions to ensure that
+ # we don't include the trailing slashes, so skip them.
+ ((route.segments.size == 1 && kind == :path) ? route.segments : route.segments[0..-2]).each do |segment|
if segment.is_a?(DynamicSegment)
elements << "\#{URI.escape(args[#{idx}].to_param, ActionController::Routing::Segment::UNSAFE_PCHAR)}"
idx += 1
@@ -96,4 +95,4 @@ module ActionController
OPTIMISERS = [PositionalArguments, PositionalArgumentsWithAdditionalParams]
end
end
-end \ No newline at end of file
+end