diff --git a/actionpack/lib/action_dispatch/routing/mapper.rb b/actionpack/lib/action_dispatch/routing/mapper.rb index 84a08770f5af414aa4b5ff57f560869d62947fd5..68f9225a45becb20b51ac256a9cda90569494bd5 100644 --- a/actionpack/lib/action_dispatch/routing/mapper.rb +++ b/actionpack/lib/action_dispatch/routing/mapper.rb @@ -240,15 +240,18 @@ def default_controller_and_action if to.respond_to?(:call) { } else - if to.is_a?(String) - controller, action = to.split('#') - elsif to.is_a?(Symbol) + controller = default_controller + action = default_action + + case to + when Symbol action = to.to_s + when /#/ + controller, action = to.split('#') + when String + controller = to end - controller ||= default_controller - action ||= default_action - if @scope[:module] && !controller.is_a?(Regexp) if controller =~ %r{\A/} controller = controller[1..-1]