提交 ed9b23d8 编写于 作者: A Aaron Patterson

invert check so we fail faster

there's no reason to to_sym the string if it doesn't match the regexp
anyway
上级 3e9158bb
......@@ -1765,7 +1765,7 @@ def name_for_action(as, action) #:nodoc:
# and return nil in case it isn't. Otherwise, we pass the invalid name
# forward so the underlying router engine treats it and raises an exception.
if as.nil?
candidate unless @set.named_routes.key?(candidate) || candidate !~ /\A[_a-z]/i
candidate unless candidate !~ /\A[_a-z]/i || @set.named_routes.key?(candidate)
else
candidate
end
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册