mirror of
https://github.com/rails/rails.git
synced 2022-11-09 12:12:34 -05:00
invert check so we fail faster
there's no reason to to_sym the string if it doesn't match the regexp anyway
This commit is contained in:
parent
3e9158bb95
commit
ed9b23d898
1 changed files with 1 additions and 1 deletions
|
@ -1765,7 +1765,7 @@ module ActionDispatch
|
|||
# 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
|
||||
|
|
Loading…
Reference in a new issue