Permalink
Browse files

Use config.controller_paths instead of pattern matching

git-svn-id: http://svn-commit.rubyonrails.org/rails/branches/stable@4749 5ecf4fe2-1ee6-0310-87b1-e25e094e27de
  • Loading branch information...
1 parent 94e1350 commit 720f990472f206788227ee8d3fc7d9c91a4cfd6e @seckar seckar committed Aug 10, 2006
Showing with 4 additions and 13 deletions.
  1. +3 −13 actionpack/lib/action_controller/routing.rb
  2. +1 −0 railties/lib/initializer.rb
@@ -262,23 +262,13 @@ def traverse_to_controller(segments, start_at = 0)
nil
end
+ attr_accessor :controller_paths
+
protected
- def safe_load_paths #:nodoc:
- if defined?(RAILS_ROOT)
- $LOAD_PATH.select do |base|
- base = File.expand_path(base)
- extended_root = File.expand_path(RAILS_ROOT)
- # Exclude all paths that are not nested within app, lib, or components.
- base.match(/\A#{Regexp.escape(extended_root)}\/*(app|lib|components)\/[a-z]/) || base =~ %r{rails-[\d.]+/builtin}
- end
- else
- $LOAD_PATH
- end
- end
def attempt_load(mod, const_name, path)
has_dir = false
- safe_load_paths.each do |load_path|
+ controller_paths.each do |load_path|
full_path = File.join(load_path, path)
file_path = full_path + '.rb'
if File.file?(file_path) # Found a .rb file? Load it up
@@ -236,6 +236,7 @@ def initialize_framework_views
# loading module used to lazily load controllers (Configuration#controller_paths).
def initialize_routing
return unless configuration.frameworks.include?(:action_controller)
+ ActionController::Routing::ControllerComponent.controller_paths = configuration.controller_paths
ActionController::Routing::Routes.reload
end

0 comments on commit 720f990

Please sign in to comment.