diff options
author | Andrew White <andyw@pixeltrix.co.uk> | 2014-01-05 19:58:04 +0000 |
---|---|---|
committer | Andrew White <andyw@pixeltrix.co.uk> | 2014-01-05 19:58:04 +0000 |
commit | 3a48b83e5eec62a5d2bfab1a118c24b45345388c (patch) | |
tree | 4d6ec108a94373c05026521940d67563f85b71a3 /actionpack/lib/action_dispatch | |
parent | a1564d470d688eecd5fd01ee771521764cba4b7b (diff) | |
download | rails-3a48b83e5eec62a5d2bfab1a118c24b45345388c.tar.gz rails-3a48b83e5eec62a5d2bfab1a118c24b45345388c.tar.bz2 rails-3a48b83e5eec62a5d2bfab1a118c24b45345388c.zip |
Allow an absolute controller path inside a module scope
Fixes #12777
Diffstat (limited to 'actionpack/lib/action_dispatch')
-rw-r--r-- | actionpack/lib/action_dispatch/routing/mapper.rb | 8 |
1 files changed, 6 insertions, 2 deletions
diff --git a/actionpack/lib/action_dispatch/routing/mapper.rb b/actionpack/lib/action_dispatch/routing/mapper.rb index 4bf2dc6e23..18f37dc732 100644 --- a/actionpack/lib/action_dispatch/routing/mapper.rb +++ b/actionpack/lib/action_dispatch/routing/mapper.rb @@ -218,8 +218,12 @@ module ActionDispatch controller ||= default_controller action ||= default_action - unless controller.is_a?(Regexp) - controller = [@scope[:module], controller].compact.join("/").presence + if @scope[:module] && !controller.is_a?(Regexp) + if controller =~ %r{\A/} + controller = controller[1..-1] + else + controller = [@scope[:module], controller].compact.join("/").presence + end end if controller.is_a?(String) && controller =~ %r{\A/} |