mirror of
https://github.com/rails/rails.git
synced 2022-11-09 12:12:34 -05:00
d8745decaf
Optional segments with a root scope need to have the leading slash outside of the parentheses, otherwise the generated url will be empty. However if the route has non-optional elements then the leading slash needs to remain inside the parentheses otherwise the generated url will have two leading slashes, e.g: Blog::Application.routes.draw do get '/(:category)', :to => 'posts#index', :as => :root get '/(:category)/author/:name', :to => 'posts#author', :as => :author end $ rake routes root GET /(:category)(.:format) posts#index author GET (/:category)/author/:name(.:format) posts#author This change adds support for optional segments that contain a slash, allowing support for urls like /page/2 for the root path, e.g: Blog::Application.routes.draw do get '/(page/:page)', :to => 'posts#index', :as => :root end $ rake routes root GET /(page/:page)(.:format) posts#index Fixes #7073 |
||
---|---|---|
.. | ||
middleware_stack | ||
request | ||
routing | ||
session | ||
callbacks_test.rb | ||
cookies_test.rb | ||
debug_exceptions_test.rb | ||
header_test.rb | ||
mapper_test.rb | ||
middleware_stack_test.rb | ||
mime_type_test.rb | ||
mount_test.rb | ||
prefix_generation_test.rb | ||
rack_cache_test.rb | ||
rack_test.rb | ||
reloader_test.rb | ||
request_id_test.rb | ||
request_test.rb | ||
response_test.rb | ||
routing_assertions_test.rb | ||
routing_test.rb | ||
show_exceptions_test.rb | ||
ssl_test.rb | ||
static_test.rb | ||
test_request_test.rb | ||
test_response_test.rb | ||
uploaded_file_test.rb | ||
url_generation_test.rb |