diff options
author | Santiago Pastorino <santiago@wyeworks.com> | 2012-01-13 18:40:34 -0200 |
---|---|---|
committer | Santiago Pastorino <santiago@wyeworks.com> | 2012-01-13 19:44:44 -0200 |
commit | c159b01b85ac3955c53cd6b8a62d5d90ee973cfb (patch) | |
tree | 09c50c90942e50d27b6f05ffc07eec9f1600a9d4 /actionpack/lib/action_dispatch/middleware/reloader.rb | |
parent | 4ca3592f86c01f265633038887af9c3c511b4022 (diff) | |
download | rails-c159b01b85ac3955c53cd6b8a62d5d90ee973cfb.tar.gz rails-c159b01b85ac3955c53cd6b8a62d5d90ee973cfb.tar.bz2 rails-c159b01b85ac3955c53cd6b8a62d5d90ee973cfb.zip |
Use a BodyProxy instead of including a Module that responds to close.
Closes #4441 if Active Record is disabled assets are delivered correctly
Diffstat (limited to 'actionpack/lib/action_dispatch/middleware/reloader.rb')
-rw-r--r-- | actionpack/lib/action_dispatch/middleware/reloader.rb | 17 |
1 files changed, 3 insertions, 14 deletions
diff --git a/actionpack/lib/action_dispatch/middleware/reloader.rb b/actionpack/lib/action_dispatch/middleware/reloader.rb index 4f48f1c974..7a5aff214d 100644 --- a/actionpack/lib/action_dispatch/middleware/reloader.rb +++ b/actionpack/lib/action_dispatch/middleware/reloader.rb @@ -1,3 +1,5 @@ +require 'action_dispatch/middleware/body_proxy' + module ActionDispatch # ActionDispatch::Reloader provides prepare and cleanup callbacks, # intended to assist with code reloading during development. @@ -61,7 +63,7 @@ module ActionDispatch @validated = @condition.call prepare! response = @app.call(env) - response[2].extend(module_hook) + response[2] = ActionDispatch::BodyProxy.new(response[2]) { cleanup! } response rescue Exception cleanup! @@ -83,18 +85,5 @@ module ActionDispatch def validated? #:nodoc: @validated end - - def module_hook #:nodoc: - middleware = self - Module.new do - define_method :close do - begin - super() if defined?(super) - ensure - middleware.cleanup! - end - end - end - end end end |