When a multipart post is sent to Rails, the framework creates a
“modified Tempfile” which is a Tempfile object but with two extra
methods: content_type and original_filename (sometimes if the file
being upload is small enough Rails will give you a modified StringIO
class).
Helpfully the framework provides ActionController::TestUploadedFile to
allow users to mimic this behavior in unit tests.
I’m finding myself hacking around Rail’s behavior - trying to pass
uploaded files to my models requires type checks: one action for
Tempfile, one for StringIO, and for testing one for TestUploadedFile.
Of course, I could just be passing the raw data to my file; but I
don’t want to fill up my RAM.
Why this design? Why not simply an ActionController::UploadedFile?
Thanks,
Ryan Dahl
ps I’m having some problems with google groups - hopefully I haven’t
sent this message multiple times to the list. If so, sorry.