This post originated from an RSS feed registered with Ruby Buzz
by Guy Naor.
Original Post: One More Fix in output_compression
Feed Title: Famundo - The Dev Blog
Feed URL: http://devblog.famundo.com/xml/rss/feed.xml
Feed Description: A blog describing the development and related technologies involved in creating famundo.com - a family management sytem written using Ruby On Rails and postgres
Working with the newly fixed output_compression for Rails 1.1, one of the developers in my team discovered that it breaks send_file() support.
The reason that happens, is that send_file() write directly to the output stream in chunks (4096 bytes be default) and so the compression will fail miserably on it.
The solution is pretty simple - as send_file() set the Content-Disposition HTML header while regular rails output doesn't, I simply disabled compression of any output with a Content-Disposition header.
The fixed file is now available for download here. Or just change the code as follows (in diff -u format):