diff options
Diffstat (limited to 'actionpack/lib/action_dispatch/routing')
-rw-r--r-- | actionpack/lib/action_dispatch/routing/mapper.rb | 18 |
1 files changed, 8 insertions, 10 deletions
diff --git a/actionpack/lib/action_dispatch/routing/mapper.rb b/actionpack/lib/action_dispatch/routing/mapper.rb index 72edf6725c..5ea694f0ff 100644 --- a/actionpack/lib/action_dispatch/routing/mapper.rb +++ b/actionpack/lib/action_dispatch/routing/mapper.rb @@ -259,11 +259,16 @@ module ActionDispatch end end - if action.is_a? Regexp + case action + when Regexp hash[:action] = action + when String, Symbol + hash[:action] = action.to_s else - check_action! action - hash[:action] = action.to_s if action + unless segment_keys.include?(:action) + message = "Missing :action key on routes definition, please check your routes." + raise ArgumentError, message + end end hash @@ -289,13 +294,6 @@ module ActionDispatch [controller, action] end - def check_action!(action) - unless action || segment_keys.include?(:action) - message = "Missing :action key on routes definition, please check your routes." - raise ArgumentError, message - end - end - def check_controller!(controller) return controller if controller =~ /\A[a-z_0-9][a-z_0-9\/]*\z/ |