We ran into a permission error using the ‘paperclip’ plugin. It had something to do with moving a tmp file into the rails public directory. The odd thing was that it could create the appropriate directories in the rails public directory, but it couldn’t copy the file.
Digging around the web, I found this group about this exact problem.
http://groups.google.com/group/paperclip-plugin/browse_thread/thread/4a0a97a08929d3a5
I found that I had all of the patches, but it still didn’t work. Most of the people on the group were complaining it that it didn’t work on Windows, and maybe had something to do with file handles, etc. We were trying to get this working in JRuby on a Joyent Solaris Accelerator, each of which can make things a little different than a MRI Rails app on Linux.
Following a tip from a user on the group, simply changing the way the move happens fixes this problem. I would like to fix the root cause, but I got it working for me, and (*open source sigh*) don’t want to isolate the exact problem.
After that, i made some change in storage.rb#flush_writes.
It’s a short workaround for
FileUtils.mv
Simply replace it withFileUtils.cp(file.path, path(style))
FileUtils.rm(file.path)Currently, it works for me. But please consider, it isn’t checked
against a well written
test or any other platform.
