From 88a3343ed57c01ca358da8473d15fc4d2b4a5bff Mon Sep 17 00:00:00 2001 From: David Heinemeier Hansson Date: Tue, 15 Feb 2005 01:24:55 +0000 Subject: Backed out of routing merge.. investigating missing patches git-svn-id: http://svn-commit.rubyonrails.org/rails/trunk@616 5ecf4fe2-1ee6-0310-87b1-e25e094e27de --- railties/lib/dispatcher.rb | 52 +++++++++++++++++++++++++++++++++------------- 1 file changed, 37 insertions(+), 15 deletions(-) (limited to 'railties/lib/dispatcher.rb') diff --git a/railties/lib/dispatcher.rb b/railties/lib/dispatcher.rb index 74de93713c..566b031295 100644 --- a/railties/lib/dispatcher.rb +++ b/railties/lib/dispatcher.rb @@ -24,34 +24,56 @@ require 'breakpoint' class Dispatcher - class << self + class < exception ActionController::Base.process_with_exception(request, response, exception).out ensure - reset_application + reset_application if Dependencies.load? + Breakpoint.deactivate_drb if defined?(BREAKPOINT_SERVER_PORT) end end private - def prepare_application - ActionController::Routing::Routes.reload if Dependencies.load? - Breakpoint.activate_drb("druby://localhost:#{BREAKPOINT_SERVER_PORT}", nil, !defined?(FastCGI)) if defined?(BREAKPOINT_SERVER_PORT) - Controllers.const_load!("application") unless Controllers.const_defined?(:ApplicationController) + def reset_application + Dependencies.clear + Dependencies.remove_subclasses_for(ActiveRecord::Base, ActiveRecord::Observer, ActionController::Base) end - def reset_application - if Dependencies.load? - Controllers.clear - Dependencies.clear - Dependencies.remove_subclasses_for(ActiveRecord::Base, ActiveRecord::Observer, ActionController::Base) + def controller_path(controller_name, module_name = nil) + if module_name + "#{module_name}/#{controller_name.underscore}_controller" + else + "#{controller_name.underscore}_controller" end + end - Breakpoint.deactivate_drb if defined?(BREAKPOINT_SERVER_PORT) + def controller_class(controller_name) + Object.const_get(controller_class_name(controller_name)) + end + + def controller_class_name(controller_name) + "#{controller_name.camelize}Controller" + end + + def controller_name(parameters) + parameters["controller"].downcase.gsub(/[^_a-zA-Z0-9]/, "").untaint + end + + def module_name(parameters) + parameters["module"].downcase.gsub(/[^_a-zA-Z0-9]/, "").untaint if parameters["module"] end end end \ No newline at end of file -- cgit v1.2.3