diff options
author | Joshua Peek <josh@joshpeek.com> | 2009-12-02 14:10:22 -0600 |
---|---|---|
committer | Joshua Peek <josh@joshpeek.com> | 2009-12-02 14:10:22 -0600 |
commit | 8db038227ca4cbcba01a86ef5fb94cb13c780463 (patch) | |
tree | b03e34fa0800175021719994fb6f1d04488e22d3 /actionpack/lib/action_dispatch/routing.rb | |
parent | 4dee277a9bc05083de6c831cf9aae0846849ecda (diff) | |
download | rails-8db038227ca4cbcba01a86ef5fb94cb13c780463.tar.gz rails-8db038227ca4cbcba01a86ef5fb94cb13c780463.tar.bz2 rails-8db038227ca4cbcba01a86ef5fb94cb13c780463.zip |
Move controller namespace tracking into route set so it gets
reloaded in dev mode
Diffstat (limited to 'actionpack/lib/action_dispatch/routing.rb')
-rw-r--r-- | actionpack/lib/action_dispatch/routing.rb | 41 |
1 files changed, 0 insertions, 41 deletions
diff --git a/actionpack/lib/action_dispatch/routing.rb b/actionpack/lib/action_dispatch/routing.rb index 9159bb6395..e99f979197 100644 --- a/actionpack/lib/action_dispatch/routing.rb +++ b/actionpack/lib/action_dispatch/routing.rb @@ -265,51 +265,10 @@ module ActionDispatch SEPARATORS = %w( / . ? ) HTTP_METHODS = [:get, :head, :post, :put, :delete, :options] - CONTROLLER_REGEXP = /[_a-zA-Z0-9]+/ - - # The root paths which may contain controller files - mattr_accessor :controller_paths - self.controller_paths = [] # A helper module to hold URL related helpers. module Helpers include ActionController::PolymorphicRoutes end - - class << self - def controller_constraints - @controller_constraints ||= begin - source = controller_namespaces.map { |ns| "#{Regexp.escape(ns)}/#{CONTROLLER_REGEXP.source}" } - source << CONTROLLER_REGEXP.source - Regexp.compile(source.sort.reverse.join('|')) - end - end - - def clear_controller_cache! - @controller_constraints = nil - end - - private - def controller_namespaces - namespaces = Set.new - - # Find any nested controllers already in memory - ActionController::Base.subclasses.each do |klass| - controller_name = klass.underscore - namespaces << controller_name.split('/')[0...-1].join('/') - end - - # Find namespaces in controllers/ directory - controller_paths.each do |load_path| - load_path = File.expand_path(load_path) - Dir["#{load_path}/**/*_controller.rb"].collect do |path| - namespaces << File.dirname(path).sub(/#{load_path}\/?/, '') - end - end - - namespaces.delete('') - namespaces - end - end end end |