| Class | ActionController::Reloader |
| In: |
vendor/rails/actionpack/lib/action_controller/reloader.rb
|
| Parent: | Object |
# File vendor/rails/actionpack/lib/action_controller/reloader.rb, line 30
30: def self.run(lock = @@default_lock)
31: lock.lock
32: begin
33: Dispatcher.reload_application
34: status, headers, body = yield
35: # We do not want to call 'cleanup_application' in an ensure block
36: # because the returned Rack response body may lazily generate its data. This
37: # is for example the case if one calls
38: #
39: # render :text => lambda { ... code here which refers to application models ... }
40: #
41: # in an ActionController.
42: #
43: # Instead, we will want to cleanup the application code after the request is
44: # completely finished. So we wrap the body in a BodyWrapper class so that
45: # when the Rack handler calls #close during the end of the request, we get to
46: # run our cleanup code.
47: [status, headers, BodyWrapper.new(body, lock)]
48: rescue Exception
49: lock.unlock
50: raise
51: end
52: end