Class: Unicorn::App::OldRails

Inherits:
Object
  • Object
show all
Defined in:
lib/unicorn/app/old_rails.rb

Overview

Implements a handler that can run Rails.

Instance Method Summary collapse

Instance Method Details

#call(env) ⇒ Object



16
17
18
19
20
21
22
23
24
25
26
27
28
29
# File 'lib/unicorn/app/old_rails.rb', line 16

def call(env)
  cgi = Unicorn::CGIWrapper.new(env)
  begin
    Dispatcher.dispatch(cgi,
        ActionController::CgiRequest::DEFAULT_SESSION_OPTIONS,
        cgi.body)
  rescue Object => e
    err = env['rack.errors']
    err.write("#{e} #{e.message}\n")
    e.backtrace.each { |line| err.write("#{line}\n") }
  end
  cgi.out  # finalize the response
  cgi.rack_response
end