Permalink
Browse files

change to case / when on types

  • Loading branch information...
1 parent b27a3af commit a729f4050766f97750dd006217a175229b09da34 @tenderlove tenderlove committed May 28, 2014
Showing with 7 additions and 8 deletions.
  1. +7 −8 actionpack/lib/action_dispatch/routing/mapper.rb
@@ -247,16 +247,15 @@ def default_controller_and_action
@scope[:module]
)
- if controller.is_a? Regexp
+ case controller
+ when Regexp
hash[:controller] = controller
+ when String, Symbol
+ hash[:controller] = check_controller!(controller).to_s
else
- if controller
- hash[:controller] = check_controller!(controller).to_s
- else
- unless segment_keys.include?(:controller)
- message = "Missing :controller key on routes definition, please check your routes."
- raise ArgumentError, message
- end
+ unless segment_keys.include?(:controller)
+ message = "Missing :controller key on routes definition, please check your routes."
+ raise ArgumentError, message
end
end

0 comments on commit a729f40

Please sign in to comment.