Yesterday, I had some problems reading JPG files in my tests. Turns
out the problem was that Windows Ruby doesn’t set it’s Tempfile to
work in binary mode. Since I deploy on Linux, that has never been a
big problem, but now I’m working on some software that works with
binary files exclusively.
Anyway, I am making this fix available as a Rails plugin.
The details can be found here:
If you’d prefer patching your Ruby, the fix is in tempfile.rb:55. Or
File::BINARY to the other constants in the File#open call.