root_path returns '/' not ''. Closes #9563.
git-svn-id: http://svn-commit.rubyonrails.org/rails/trunk@7482 5ecf4fe2-1ee6-0310-87b1-e25e094e27de
This commit is contained in:
parent
41ef9211a2
commit
494d2c631b
@ -1,5 +1,7 @@
|
||||
*SVN*
|
||||
|
||||
* root_path returns '/' not ''. #9563 [lifofifo]
|
||||
|
||||
* Fixed that setting request.format should also affect respond_to blocks [DHH]
|
||||
|
||||
* Add option to force binary mode on tempfile used for fixture_file_upload. #6380 [Jonathan Viney]
|
||||
|
@ -62,11 +62,10 @@ def generation_code
|
||||
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 @@ def generation_code
|
||||
OPTIMISERS = [PositionalArguments, PositionalArgumentsWithAdditionalParams]
|
||||
end
|
||||
end
|
||||
end
|
||||
end
|
||||
|
@ -218,7 +218,16 @@ def test_named_route_without_hash
|
||||
map.normal ':controller/:action/:id'
|
||||
end
|
||||
end
|
||||
|
||||
|
||||
def test_named_route_root
|
||||
rs.draw do |map|
|
||||
map.root :controller => "hello"
|
||||
end
|
||||
x = setup_for_named_route
|
||||
assert_equal("http://named.route.test", x.send(:root_url))
|
||||
assert_equal("/", x.send(:root_path))
|
||||
end
|
||||
|
||||
def test_named_route_with_regexps
|
||||
rs.draw do |map|
|
||||
map.article 'page/:year/:month/:day/:title', :controller => 'page', :action => 'show',
|
||||
|
Loading…
Reference in New Issue
Block a user