diff --git a/actionpack/lib/action_dispatch/routing/mapper.rb b/actionpack/lib/action_dispatch/routing/mapper.rb index 6a4b57e3f924b005166d3ed3e25fbb936841ca8f..526c97ff8e205c8c1a28baa1cb82ec73d464582d 100644 --- a/actionpack/lib/action_dispatch/routing/mapper.rb +++ b/actionpack/lib/action_dispatch/routing/mapper.rb @@ -152,7 +152,10 @@ def default_controller_and_action(to_shorthand=nil) raise ArgumentError, "missing :action" end - { :controller => controller, :action => action } + { :controller => controller, :action => action }.tap do |hash| + hash.delete(:controller) if hash[:controller].blank? + hash.delete(:action) if hash[:action].blank? + end end end