def controller
unless params[:controller]
raise ControllerExceptions::NotFound,
"Route matched, but route did not specify a controller.\n" +
"Did you forgot to add :controller => \"people\" or :controller " +
"segment to route definition?\nHere is what's specified:\n" +
route.inspect
end
path = [params[:namespace], params[:controller]].compact.join(Merb::Const::SLASH)
controller = path.snake_case.to_const_string
begin
Object.full_const_get(controller)
rescue NameError => e
msg = "Controller class not found for controller `#{path}'"
Merb.logger.warn!(msg)
raise ControllerExceptions::NotFound, msg
end
end