diff options
author | Nicholas Seckar <nseckar@gmail.com> | 2006-02-04 05:20:25 +0000 |
---|---|---|
committer | Nicholas Seckar <nseckar@gmail.com> | 2006-02-04 05:20:25 +0000 |
commit | dfa6e14af67f3c3532cf9645f6ce4b709f0b70f8 (patch) | |
tree | e2776483de29222e4e7f27f228729300d4bb7562 /actionpack/lib/action_controller | |
parent | c77729fd23ccf169cafd1d72eb469fe1e4e42ea0 (diff) | |
download | rails-dfa6e14af67f3c3532cf9645f6ce4b709f0b70f8.tar.gz rails-dfa6e14af67f3c3532cf9645f6ce4b709f0b70f8.tar.bz2 rails-dfa6e14af67f3c3532cf9645f6ce4b709f0b70f8.zip |
Fix controller resolution to avoid accidentally inheriting a controller from a parent module.
git-svn-id: http://svn-commit.rubyonrails.org/rails/trunk@3530 5ecf4fe2-1ee6-0310-87b1-e25e094e27de
Diffstat (limited to 'actionpack/lib/action_controller')
-rw-r--r-- | actionpack/lib/action_controller/routing.rb | 8 |
1 files changed, 6 insertions, 2 deletions
diff --git a/actionpack/lib/action_controller/routing.rb b/actionpack/lib/action_controller/routing.rb index 7693cd0711..fe0d7be541 100644 --- a/actionpack/lib/action_controller/routing.rb +++ b/actionpack/lib/action_controller/routing.rb @@ -233,15 +233,19 @@ module ActionController controller_name = "#{mod_name}Controller" suppress(NameError) do - controller = mod.const_get(controller_name) + ActionController::Base.logger.info("Looking for #{controller_name}") + controller = eval("mod::#{controller_name}", nil, __FILE__, __LINE__) + ActionController::Base.logger.info("Found") # Detect the case when const_get returns an object from a parent namespace. + + ActionController::Base.logger.info("#{controller.name} == #{mod.name}::#{controller_name}") if mod == Object || controller.name == "#{mod.name}::#{controller_name}" return controller, (index - start_at) end end mod = suppress(NameError) do - next_mod = mod.const_get(mod_name) + next_mod = eval("mod::#{mod_name}", nil, __FILE__, __LINE__) # Check that we didn't get a module from a parent namespace (mod == Object || next_mod.name == "#{mod.name}::#{controller_name}") ? next_mod : nil end |