aboutsummaryrefslogtreecommitdiffstats
path: root/actionpack/lib/action_controller
diff options
context:
space:
mode:
authorNicholas Seckar <nseckar@gmail.com>2006-02-04 23:59:37 +0000
committerNicholas Seckar <nseckar@gmail.com>2006-02-04 23:59:37 +0000
commit545053856367b7ac42f556c113a23252d3e55c5a (patch)
treec628ac4497716c35d2150bb08e7e2ae80adecd85 /actionpack/lib/action_controller
parent427d0a8d14aaca59bbf2d33dba6b4a1232f895f0 (diff)
downloadrails-545053856367b7ac42f556c113a23252d3e55c5a.tar.gz
rails-545053856367b7ac42f556c113a23252d3e55c5a.tar.bz2
rails-545053856367b7ac42f556c113a23252d3e55c5a.zip
Don't let arbitrary classes match as controllers
git-svn-id: http://svn-commit.rubyonrails.org/rails/trunk@3542 5ecf4fe2-1ee6-0310-87b1-e25e094e27de
Diffstat (limited to 'actionpack/lib/action_controller')
-rw-r--r--actionpack/lib/action_controller/routing.rb3
1 files changed, 2 insertions, 1 deletions
diff --git a/actionpack/lib/action_controller/routing.rb b/actionpack/lib/action_controller/routing.rb
index a779b443ef..af9baa54af 100644
--- a/actionpack/lib/action_controller/routing.rb
+++ b/actionpack/lib/action_controller/routing.rb
@@ -234,9 +234,10 @@ module ActionController
suppress(NameError) do
controller = eval("mod::#{controller_name}", nil, __FILE__, __LINE__)
+ expected_name = "#{mod.name}::#{controller_name}"
# Detect the case when const_get returns an object from a parent namespace.
- if mod == Object || controller.name == "#{mod.name}::#{controller_name}"
+ if controller.is_a?(Class) && controller.ancestors.include?(ActionController::Base) && (mod == Object || controller.name == expected_name)
return controller, (index - start_at)
end
end