delayed_job and files: uninitialized stream

1,411 views
Skip to first unread message

kineticac

unread,
Sep 19, 2009, 9:09:47 PM9/19/09
to delayed_job
If I try to save files with delayed_job, I get an uninitialized
stream. I believe this is because the file I'm uploading is passed as
a parameter, which is no longer opened as a stream.

How do I get around this problem?

Brandon Keepers

unread,
Sep 20, 2009, 10:42:15 AM9/20/09
to delay...@googlegroups.com
You will need to save the file on the filesystem and pass the path to
the file to your delayed job, which can re-open and handle the file.
I've used Paperclip (http://github.com/thoughtbot/paperclip) to save
the file with a model, and then pass a reference to the model to the
delayed job.

Brandon

kineticac

unread,
Sep 20, 2009, 3:33:55 PM9/20/09
to delayed_job
That seems to be the only way, but doesn't that defeat the purpose of
delaying a file save if it's too big? I'm saving it into paperclip as
well, but in case the file is really big, I'd rather have a different
thread handle it. I'm guessing I can delay the thumbnail creation,
which would help, but not sure if what I'm trying to do is ever
possible.

Partha S

unread,
Mar 14, 2014, 5:13:01 AM3/14/14
to delay...@googlegroups.com
I am facing the same problem, I am posting images to twitter with delayed jobs. But i am getting IOerror uninitialized constant stream,, I am not saving the images to database, simply i am sending the params , so if have any solution let me know
Reply all
Reply to author
Forward
0 new messages