Skip to content

Commit

Permalink
Can't use controller_path due to Admin model and Admin::UserControlle…
Browse files Browse the repository at this point in the history
…r case

git-svn-id: http://svn-commit.rubyonrails.org/rails/branches/stable@4750 5ecf4fe2-1ee6-0310-87b1-e25e094e27de
  • Loading branch information
seckar committed Aug 10, 2006
1 parent 720f990 commit e071b60
Show file tree
Hide file tree
Showing 2 changed files with 13 additions and 4 deletions.
16 changes: 13 additions & 3 deletions actionpack/lib/action_controller/routing.rb
Expand Up @@ -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
Expand Down
1 change: 0 additions & 1 deletion railties/lib/initializer.rb
Expand Up @@ -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

Expand Down

0 comments on commit e071b60

Please sign in to comment.