Ruby on Rails | Screencasts | Download | Documentation | Weblog | Community | Source
Show
Ignore:
Timestamp:
08/10/06 17:13:55 (2 years ago)
Author:
ulysses
Message:

Can't use controller_path due to Admin model and Admin::UserController case

Files:

Legend:

Unmodified
Added
Removed
Modified
Copied
Moved
  • branches/stable/actionpack/lib/action_controller/routing.rb

    r4749 r4750  
    263263        end 
    264264         
    265         attr_accessor :controller_paths 
    266          
    267265      protected 
     266        def safe_load_paths #:nodoc: 
     267          if defined?(RAILS_ROOT) 
     268            $LOAD_PATH.select do |base| 
     269              base = File.expand_path(base) 
     270              extended_root = File.expand_path(RAILS_ROOT) 
     271              # Exclude all paths that are not nested within app, lib, or components. 
     272              base.match(/\A#{Regexp.escape(extended_root)}\/*(app|lib|components)\/[a-z]/) || base =~ %r{rails-[\d.]+/builtin} 
     273            end 
     274          else 
     275            $LOAD_PATH 
     276          end 
     277        end 
    268278         
    269279        def attempt_load(mod, const_name, path) 
    270280          has_dir = false 
    271           controller_paths.each do |load_path| 
     281          safe_load_paths.each do |load_path| 
    272282            full_path = File.join(load_path, path) 
    273283            file_path = full_path + '.rb'