在我的开发环境中,代码库使用 samba 挂载安装在 ubuntu-server VM 上,它以 root 身份挂载,我以 root 身份运行 mongrel。
当我尝试使用 Paperclip 上传文件时,文件保存得很好,但是创建不同的样式似乎有问题。
我收到以下错误:
Errno::EACCES (Permission denied - /foo/some/file/path/file-name-style.jpg):
/usr/lib/ruby/1.8/fileutils.rb:1272:in `chown'
/usr/lib/ruby/1.8/fileutils.rb:1272:in `copy_metadata'
/usr/lib/ruby/1.8/fileutils.rb:452:in `copy_entry'
/usr/lib/ruby/1.8/fileutils.rb:1324:in `traverse'
/usr/lib/ruby/1.8/fileutils.rb:448:in `copy_entry'
/usr/lib/ruby/1.8/fileutils.rb:507:in `mv'
/usr/lib/ruby/1.8/fileutils.rb:1395:in `fu_each_src_dest'
/usr/lib/ruby/1.8/fileutils.rb:1411:in `fu_each_src_dest0'
/usr/lib/ruby/1.8/fileutils.rb:1393:in `fu_each_src_dest'
/usr/lib/ruby/1.8/fileutils.rb:494:in `mv'
vendor/gems/thoughtbot-paperclip-2.3.0/lib/paperclip/storage.rb:43:in `flush_writes'
vendor/gems/thoughtbot-paperclip-2.3.0/lib/paperclip/storage.rb:39:in `each'
vendor/gems/thoughtbot-paperclip-2.3.0/lib/paperclip/storage.rb:39:in `flush_writes'
vendor/gems/thoughtbot-paperclip-2.3.0/lib/paperclip/attachment.rb:142:in `save'
vendor/gems/thoughtbot-paperclip-2.3.0/lib/paperclip.rb:331:in `send'
vendor/gems/thoughtbot-paperclip-2.3.0/lib/paperclip.rb:331:in `save_attached_files'
vendor/gems/thoughtbot-paperclip-2.3.0/lib/paperclip.rb:324:in `each_attachment'
vendor/gems/thoughtbot-paperclip-2.3.0/lib/paperclip.rb:323:in `each'
vendor/gems/thoughtbot-paperclip-2.3.0/lib/paperclip.rb:323:in `each_attachment'
vendor/gems/thoughtbot-paperclip-2.3.0/lib/paperclip.rb:330:in `save_attached_files'
但是,如果我从已安装代码的文件夹结构中删除 /foo/ 并使其成为直接指向 Ubuntu VM 内某处的符号链接,则它可以正常工作。