加入收藏 | 设为首页 | 会员中心 | 我要投稿 李大同 (https://www.lidatong.com.cn/)- 科技、建站、经验、云计算、5G、大数据,站长网!
当前位置: 首页 > 百科 > 正文

ruby-on-rails-3.1 – 为什么我从Paperclip收到“Too many open

发布时间:2020-12-17 03:22:10 所属栏目:百科 来源:网络整理
导读:我正在尝试为回形针运行干净的rake任务,因为我刚刚将所有以前的png图像转换为jpg而且我一直在 rake aborted!Too many open files - convert 我敢肯定我有超过10,000张图片,有6种不同的款式,有关如何解决这个问题的想法吗? 解决方法 看看这是否回答了你的问
我正在尝试为回形针运行干净的rake任务,因为我刚刚将所有以前的png图像转换为jpg而且我一直在

rake aborted!
Too many open files - convert

我敢肯定我有超过10,000张图片,有6种不同的款式,有关如何解决这个问题的想法吗?

解决方法

看看这是否回答了你的问题: https://github.com/thoughtbot/paperclip/issues/862

从那个线程,

Sikachu (07001) said:

“That means you aren’t closing the file after assigning to Paperclip. You have to close the file after >assign it to the attachment,as Paperclip clones your file as a Tempfile right after the assignment. >We’ve done that to prevent undesired behavior (say,trying to rewind the file after you assign it to >Paperclip.)”

file = File.open("foo.jpg")
@user.attachment = file
file.close # totally safe!

(编辑:李大同)

【声明】本站内容均来自网络,其相关言论仅代表作者个人观点,不代表本站立场。若无意侵犯到您的权利,请及时与联系站长删除相关内容!

    推荐文章
      热点阅读