提交 1ad50aa3 编写于 作者: A Aaron Patterson

set defaults at the top so we can avoid the ||= test

上级 e135bbac
...@@ -240,15 +240,18 @@ def default_controller_and_action ...@@ -240,15 +240,18 @@ def default_controller_and_action
if to.respond_to?(:call) if to.respond_to?(:call)
{ } { }
else else
if to.is_a?(String) controller = default_controller
controller, action = to.split('#') action = default_action
elsif to.is_a?(Symbol)
case to
when Symbol
action = to.to_s action = to.to_s
when /#/
controller, action = to.split('#')
when String
controller = to
end end
controller ||= default_controller
action ||= default_action
if @scope[:module] && !controller.is_a?(Regexp) if @scope[:module] && !controller.is_a?(Regexp)
if controller =~ %r{\A/} if controller =~ %r{\A/}
controller = controller[1..-1] controller = controller[1..-1]
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册