From 5b54051db6fa14079fcbe55335a0af57a5fac224 Mon Sep 17 00:00:00 2001 From: Gibheer Date: Sun, 27 Oct 2013 19:46:02 +0100 Subject: [PATCH] fix namespace leak --- lib/router.rb | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/lib/router.rb b/lib/router.rb index 8577f49..a11a978 100644 --- a/lib/router.rb +++ b/lib/router.rb @@ -3,7 +3,6 @@ class Router # get the controller handling the request def self.call(session) variables = session.request.path.match(ROUTE_REGEX) - puts variables.inspect return default_route unless variables && variables[:controller] session.options[:id] = variables[:id] find(variables[:controller]) @@ -32,7 +31,8 @@ class Router # check for the controller name and return 404 when not found def self.find(ctrl) ctrl = ctrl.capitalize - return namespace.const_get(ctrl) if namespace.const_defined?(ctrl) + # make constant lookup without ancestors + return namespace.const_get(ctrl, false) if namespace.const_defined?(ctrl, false) namespace::RouteNotFound end end