From ed9b23d8986a2d4025913e7c56f353a579ab0189 Mon Sep 17 00:00:00 2001 From: Aaron Patterson Date: Thu, 31 Jul 2014 11:25:01 -0700 Subject: invert check so we fail faster there's no reason to to_sym the string if it doesn't match the regexp anyway --- actionpack/lib/action_dispatch/routing/mapper.rb | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'actionpack/lib/action_dispatch/routing/mapper.rb') diff --git a/actionpack/lib/action_dispatch/routing/mapper.rb b/actionpack/lib/action_dispatch/routing/mapper.rb index 0e8badc498..5982dc862c 100644 --- a/actionpack/lib/action_dispatch/routing/mapper.rb +++ b/actionpack/lib/action_dispatch/routing/mapper.rb @@ -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 -- cgit v1.2.3