Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Browse files

Can't use controller_path due to Admin model and Admin::UserControlle…

…r case

git-svn-id: http://svn-commit.rubyonrails.org/rails/branches/stable@4750 5ecf4fe2-1ee6-0310-87b1-e25e094e27de
  • Loading branch information...
commit e071b60e17913e210baf9bf77c4c5c0bb344d999 1 parent 720f990
Nicholas Seckar seckar authored
16 actionpack/lib/action_controller/routing.rb
View
@@ -262,13 +262,23 @@ 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
- controller_paths.each do |load_path|
+ safe_load_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
1  railties/lib/initializer.rb
View
@@ -236,7 +236,6 @@ 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
Please sign in to comment.
Something went wrong with that request. Please try again.