Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Browse files

Extract Routing.controller_constraints

  • Loading branch information...
commit 8d351eac078642505057351e7113100550ed8bc7 1 parent 53d7acd
Joshua Peek josh authored
4 actionpack/lib/action_dispatch/routing.rb
View
@@ -276,6 +276,10 @@ module Helpers
end
class << self
+ def controller_constraints
+ Regexp.union(*possible_controllers.collect { |n| Regexp.escape(n) })
+ end
+
# Expects an array of controller names as the first argument.
# Executes the passed block with only the named controllers named available.
# This method is used in internal Rails testing.
3  actionpack/lib/action_dispatch/routing/deprecated_mapper.rb
View
@@ -113,8 +113,7 @@ def connect(path, options = {})
end
end
- possible_names = Routing.possible_controllers.collect { |n| Regexp.escape(n) }
- requirements[:controller] ||= Regexp.union(*possible_names)
+ requirements[:controller] ||= Routing.controller_constraints
if defaults[:controller]
defaults[:action] ||= 'index'
2  actionpack/lib/action_dispatch/routing/mapper.rb
View
@@ -282,6 +282,8 @@ def match(*args)
constraints.reject! { |k, v| segment_keys.include?(k.to_s) }
conditions.merge!(constraints)
+ requirements[:controller] ||= Routing.controller_constraints
+
if via = options[:via]
via = Array(via).map { |m| m.to_s.upcase }
conditions[:request_method] = Regexp.union(*via)
Please sign in to comment.
Something went wrong with that request. Please try again.