Has anyone had any success using Rick O.'s “attachment_fu” plugin
while developing on a Windows machine?
I’ve been looking for solutions to the issue described here
http://railsweenie.com/forums/3/topics/1257 but haven’t heard anything
The issue is that attachment_fu fails to record the uploaded file’s size
value properly, causing its validations to fail.
Iâ€™ve been adding logger messages into the attachment_fu code to see
whatâ€™s causing my problems on Windows. In my case itâ€™s not properly
assigning the â€œsizeâ€ attribute.
In â€œattachment_fu.rbâ€, there is the following method:
self.size = File.size(temp_path) if save_attachment?
Based on logger messages, Iâ€™ve determined that save_attachment? returns
true, the temporary file does exist on my system, but that fileâ€™s
File.size parameter returns zero, so it saves self.size as zero, thus
failing the validations.
In my case, the uploaded_data IS properly assigned, and the image is
saved to the disk in the appropriate place. The only problem Iâ€™ve found
is with the size parameter. To complicate matters, the behavior is not
consistent. Occasionally it saves a size value, but most of the time the
size is zero.
Iâ€™ve created a brand new Rails app and model which uses only
attachment_fuâ€™s required fields to test these conclusions.
On my system Iâ€™m using:
- Rails 1.2.2
- Windows XP
- MySQL 5.0
- mini_magick 1.2.0
When attachment_fu creates thumbnails, the thumbnail files ARE saved
with the correct size in their model. I donâ€™t know why the original
Does this have to do with Windows â€œTempfileâ€ issues? I tried out a
â€œwindows_tempfile_fixâ€ plugin but it required Ruby 1.8.4 where I have
Does anyone have any ideas? Thanks,