aboutsummaryrefslogtreecommitdiffstats
path: root/actionpack/lib
diff options
context:
space:
mode:
Diffstat (limited to 'actionpack/lib')
-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