Skip to content

Instantly share code, notes, and snippets.

@mikhailov
Created February 6, 2016 00:55
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save mikhailov/7e6d925044327a87db4f to your computer and use it in GitHub Desktop.
Save mikhailov/7e6d925044327a87db4f to your computer and use it in GitHub Desktop.
module ActionDispatch
class Reloader
def call(env)
if env['PATH_INFO'].include?(Rails.application.config.assets.prefix)
@app.call(env)
else
@validated = @condition.call
prepare!
response = @app.call(env)
response[2] = ::Rack::BodyProxy.new(response[2]) { cleanup! }
response
end
rescue Exception
cleanup!
raise
end
end
end
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment