Class: Dispatcher

Inherits:
Object show all
Defined in:
lib/dispatcher.rb

Class Method Summary collapse

Class Method Details

.dispatch(cgi = CGI.new, session_options = ActionController::CgiRequest::DEFAULT_SESSION_OPTIONS, output = $stdout) ⇒ Object



28
29
30
31
32
33
34
35
36
37
38
# File 'lib/dispatcher.rb', line 28

def dispatch(cgi = CGI.new, session_options = ActionController::CgiRequest::DEFAULT_SESSION_OPTIONS, output = $stdout)
  begin
    request, response = ActionController::CgiRequest.new(cgi, session_options), ActionController::CgiResponse.new(cgi)
    prepare_application
    ActionController::Routing::Routes.recognize!(request).process(request, response).out(output)
  rescue Object => exception
    ActionController::Base.process_with_exception(request, response, exception).out(output)
  ensure
    reset_after_dispatch
  end
end

.reset_application!Object



40
41
42
43
44
45
# File 'lib/dispatcher.rb', line 40

def reset_application!
  Controllers.clear!
  Dependencies.clear
  Dependencies.remove_subclasses_for(ActiveRecord::Base, ActiveRecord::Observer, ActionController::Base)
  Dependencies.remove_subclasses_for(ActionMailer::Base) if defined?(ActionMailer::Base)
end