Don't like ads? PRO users don't see any ads ;-)
Guest

Untitled

By: a guest on Jun 30th, 2012  |  syntax: None  |  size: 0.35 KB  |  hits: 13  |  expires: Never
download  |  raw  |  embed  |  report abuse  |  print
Text below is selected. Please press Ctrl+C to copy to your clipboard. (⌘+C on Mac)
  1. In rails, can I access response.body in a action before it returns?
  2. module Dump
  3.   require 'rack'
  4.  
  5.   class Response
  6.     def initialize(app)
  7.        @app=app
  8.     end
  9.  
  10.     def call(env)
  11.        res=@app.call(env)
  12.        res.body #change this and but also update res.length and header["Content-Length"]
  13.        return res
  14.     end
  15.   end
  16. end
  17.        
  18. use Dump::Response