aboutsummaryrefslogtreecommitdiffstats
path: root/actionpack
diff options
context:
space:
mode:
authorRichard Schneeman <richard.schneeman@gmail.com>2015-08-02 12:42:56 -0500
committerRichard Schneeman <richard.schneeman@gmail.com>2015-08-02 12:42:56 -0500
commit61ed2b38c4eaad48b973684f25c98a4338e87f90 (patch)
tree8e3b3631de9fcdb5deb559f7335aa49664093e5d /actionpack
parent1c912125ac4ba066c6924e553349d98ca68f008d (diff)
parent113f8a6cc91e41d3d009f0c1941eb1db2dba1463 (diff)
downloadrails-61ed2b38c4eaad48b973684f25c98a4338e87f90.tar.gz
rails-61ed2b38c4eaad48b973684f25c98a4338e87f90.tar.bz2
rails-61ed2b38c4eaad48b973684f25c98a4338e87f90.zip
Merge pull request #21100 from bquorning/route-set
Use #start_with? and #[] for speed
Diffstat (limited to 'actionpack')
-rw-r--r--actionpack/lib/action_dispatch/routing/route_set.rb4
1 files changed, 2 insertions, 2 deletions
diff --git a/actionpack/lib/action_dispatch/routing/route_set.rb b/actionpack/lib/action_dispatch/routing/route_set.rb
index a006a146ed..c968381c26 100644
--- a/actionpack/lib/action_dispatch/routing/route_set.rb
+++ b/actionpack/lib/action_dispatch/routing/route_set.rb
@@ -676,8 +676,8 @@ module ActionDispatch
# Remove leading slashes from controllers
def normalize_controller!
if controller
- if m = controller.match(/\A\/(?<controller_without_leading_slash>.*)/)
- @options[:controller] = m[:controller_without_leading_slash]
+ if controller.start_with?("/".freeze)
+ @options[:controller] = controller[1..-1]
else
@options[:controller] = controller
end