Rails 关于 middleware 的疑问.

glorySpring · March 07, 2014 · Last by _kaichen replied at March 09, 2014 · 2223 hits

在项目内添加了一个 gzip 的 middleware,一切使用正常,但是当我整合图片上传 gem(Paperclip) 以后就出现问题了. 爆出的错误是这个样子的:

Paperclip::Errors::MissingRequiredValidatorError (Paperclip::Errors::MissingRequiredValidatorError):
app/controllers/users/mobileinterface_controller.rb:584:in `uploadPhotoVResource'
lib/middleware/gzip_request.rb:23:in `call'

然后这里 (gzip_request.rb:23:in `call') 写的代码是:

status, headers, response = @app.call(env)

我想问的是,有什么办法让这个请求并不走这个 middleware 呢?

加一些判断在 Middleware 中,比如通过 URL 判断env['PATH_INFO']

You need to Sign in before reply, if you don't have an account, please Sign up first.