Archive for attachment_fu

Attachment Fu

Posted in Programming with tags , on June 12, 2008 by dialgforgerald

Attachment_fu is an awesome Rails plugin which would make your life easier by taking care of all of your file upload needs. It even creates thumbnails for images and handles validation for you. Sweet. I won’t be getting into tutorial mode here because Mike Clark did a very good job with that and you should drop by his site if you want to learn more about how to use the plugin. Instead here are some stuff I encountered while developing with attachment_fu.

If you are developing in Windows, you might encounter a weird bug where attachment_fu will complain that “Size not included in list” and when you check the file it has a size of 0. Apparently you have to put a sleep before saving the image. So instead of doing:

@mugshot =[:mugshot])

You should do:

@mugshot =[:mugshot])
sleep 5

Sleep 1 should be fine but I used 5 just to be sure. I think this applies to Windows only because I haven’t encountered it anywhere before.