Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP
Browse files

"controllers" should be a valid path name

  • Loading branch information...
commit 8ed1a562c6293c81c894f3fe55fe88610c4f6caa 1 parent 7e61a32
@tenderlove tenderlove authored
View
2  actionpack/lib/action_dispatch/routing/mapper.rb
@@ -117,7 +117,7 @@ def normalize_options!(options)
options[$1.to_sym] ||= /.+?/
end
- if path_without_format.match(':controller')
+ if path_pattern.names.map(&:to_sym).include?(:controller)
raise ArgumentError, ":controller segment is not allowed within a namespace block" if scope[:module]
# Add a default constraint for :controller path segments that matches namespaced
View
10 actionpack/test/dispatch/routing_test.rb
@@ -99,6 +99,16 @@ def test_namespace_with_controller_segment
end
end
+ def test_namespace_without_controller_segment
+ draw do
+ namespace :admin do
+ get 'hello/:controllers/:action'
+ end
+ end
+ get '/admin/hello/foo/new'
+ assert_equal 'foo', @request.params["controllers"]
+ end
+
def test_session_singleton_resource
draw do
resource :session do
Please sign in to comment.
Something went wrong with that request. Please try again.