From c99d28f1f223e87523559f071eca2d84ac41f14c Mon Sep 17 00:00:00 2001 From: Aaron Patterson Date: Wed, 28 May 2014 15:46:00 -0700 Subject: reduce action.blank? calls --- actionpack/lib/action_dispatch/routing/mapper.rb | 10 ++++++---- 1 file changed, 6 insertions(+), 4 deletions(-) (limited to 'actionpack/lib/action_dispatch') diff --git a/actionpack/lib/action_dispatch/routing/mapper.rb b/actionpack/lib/action_dispatch/routing/mapper.rb index 565609542a..178728ea2a 100644 --- a/actionpack/lib/action_dispatch/routing/mapper.rb +++ b/actionpack/lib/action_dispatch/routing/mapper.rb @@ -262,8 +262,6 @@ module ActionDispatch hash = {} - action = action.to_s unless action.is_a?(Regexp) - if controller.is_a? Regexp hash[:controller] = controller else @@ -271,9 +269,13 @@ module ActionDispatch hash[:controller] = controller.to_s if controller end - check_action! action + if action.is_a? Regexp + hash[:action] = action + else + check_action! action.to_s + hash[:action] = action.to_s if action + end - hash[:action] = action unless action.blank? hash end end -- cgit v1.2.3