IO object rewind

Hey, I had an issue with checking uploaded images in Rails, before further processing them. I also wrote a test.