title: Hello World rack middleware with rails 3: how to process body of all requests
body: <p>i want to try out a simple rack middleware "hello world", but i seem to get stuck.
  it looks like the main sytax changed, since some examples use this code:</p>
  
  <pre><code>require 'rack/utils'
  
  class FooBar
  
    def initialize(app)
      @app = app
    end
  
    def call(env)
      status, headers, body = @app.call(env)
           body.body &lt;&lt; "\nHi from #{self.class}"
           [status, headers, body]
    end
  end
  </code></pre>
  
  <p>produces an error: </p>
  
  <pre><code>undefined method `&lt;&lt;' for #&lt;ActionDispatch::Response:0x103f07c48&gt;
  </code></pre>
  
  <p>even when i look at other codes out there, i cannot seem to get them running with rails 3.0.3. </p>
  
  <p>here are my concrete questions:</p>
  
  <ul>
  <li>how can i get a simple rack middleware to run and modify the body of any output from a rails app?</li>
  <li>where should i put the Rails.application.config.middleware.use declaration? (i created an own initializer in config/initializers for that)</li>
  </ul>
  
  <p>thanks a lot in advance!</p>