Skip to content

Instantly share code, notes, and snippets.

@ryanbriones
Created September 28, 2009 12:05
Show Gist options
  • Save ryanbriones/195369 to your computer and use it in GitHub Desktop.
Save ryanbriones/195369 to your computer and use it in GitHub Desktop.
fix for using mongrel_rails with Rails ~> 2.3.3
require 'rewindable_input'
ActionController::Dispatcher.middleware.insert_before ActionController::ParamsParser, RewindableInput
class RewindableInput
def initialize(app)
@app = app
end
def call(env)
begin
env['rack.input'].rewind
rescue NoMethodError, Errno::ESPIPE
# Handles exceptions raised by input streams that cannot be rewound
# such as when using plain CGI under Apache
env['rack.input'] = StringIO.new(env['rack.input'].read)
end
@app.call(env)
end
end
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment