[Mongrel] Mongrel upload progress and models with other fields

Joey Geiger jgeiger at gmail.com
Fri Feb 16 09:42:17 EST 2007

I'm trying to set up a system that will allow users to upload files
using the mongrel upload progress gem to a model that includes other

While I'm willing to hack around with this myself for a while to get
it working, I was hoping that someone had done this before and might
be able to give me some hints/code to look at.

My mediafile has a description, mediatype, filename, size,
content_type and data field. (Yes I'm storing it in the db, but I will
also save it on the drive to serve).

Essentially I'm using the upload example but I added in a couple of
fields into the code. I think among the issues I'm running into is
that the mongrel handler is catching the file before the active record
validations are hit, and thus will still upload the file, even though
the description is blank. The other problem is that if there is an
error, or it finishes correctly, it's sending the response back to the
iframe. I'm not using rjs/js for the response at the moment, as I'm
trying to use the rails AR error handlers for a consistent look.

The other question I have is how or where the best place to start the
drb service "ruby lib/upload.rb" so I don't have to do it by hand. Is
this something monit could handle, since I'm using monit to start up
my mongrel cluster, or can I drop that code into one of the config


More information about the Mongrel-users mailing list