diff options
author | Andrew White <andyw@pixeltrix.co.uk> | 2011-03-06 07:08:50 +0000 |
---|---|---|
committer | Andrew White <andyw@pixeltrix.co.uk> | 2011-03-06 07:08:50 +0000 |
commit | e00867bc437b6a681491ef59e13423051e6d98f0 (patch) | |
tree | 75e82e12162d49368d007f723a1a39dcfe5fe5c3 /actionpack/lib | |
parent | 0509bf35f1987c1e0b9c3dd1389778f8426180f7 (diff) | |
download | rails-e00867bc437b6a681491ef59e13423051e6d98f0.tar.gz rails-e00867bc437b6a681491ef59e13423051e6d98f0.tar.bz2 rails-e00867bc437b6a681491ef59e13423051e6d98f0.zip |
Raise ArgumentError if route name is invalid [#6517 state:resolved]
Diffstat (limited to 'actionpack/lib')
-rw-r--r-- | actionpack/lib/action_dispatch/routing/route_set.rb | 2 |
1 files changed, 2 insertions, 0 deletions
diff --git a/actionpack/lib/action_dispatch/routing/route_set.rb b/actionpack/lib/action_dispatch/routing/route_set.rb index fc86d52a3a..61053d4464 100644 --- a/actionpack/lib/action_dispatch/routing/route_set.rb +++ b/actionpack/lib/action_dispatch/routing/route_set.rb @@ -1,5 +1,6 @@ require 'rack/mount' require 'forwardable' +require 'active_support/core_ext/object/blank' require 'active_support/core_ext/object/to_query' require 'active_support/core_ext/hash/slice' @@ -330,6 +331,7 @@ module ActionDispatch end def add_route(app, conditions = {}, requirements = {}, defaults = {}, name = nil, anchor = true) + raise ArgumentError, "Invalid route name: '#{name}'" unless name.blank? || name.to_s.match(/^[_a-z]\w*$/i) route = Route.new(self, app, conditions, requirements, defaults, name, anchor) @set.add_route(*route) named_routes[name] = route if name |