尝试让回形针刷新或重新处理不起作用

发布于 2024-09-04 23:46:29 字数 1175 浏览 1 评论 0原文

随着时间的推移,我改变了类交易拇指的大小。通过这些更改,用户正在上传到网站,因此很少有人有不同大小的拇指。我想重新处理或刷新这些,所以我进入我的根目录并输入:

rake paperclip:refresh class=Deal

对拇指尺寸没有执行任何操作..然后我在脚本/控制台中:

Deal.find(987).reprocess!

返回:

NoMethodError: undefined method `reprocess!' for #<Deal:0xb68a0988>
from /data/HQ_Channel/releases/20100607130346/vendor/rails/activerecord/lib/active_record/attribute_methods.rb:260:in `method_missing'
from (irb):7

我的交易类是这样的:

=> Deal(id: integer, organization_id: integer, deal: string, value: string, what: string, description: string, image_file_name: string, image_content_type: string, image_file_size: integer, image_updated_at: datetime, created_at: datetime, updated_at: datetime, deal_image_file_name: string, deal_image_content_type: string, deal_image_file_size: integer, deal_image_uploaded_at: datetime)

我该怎么做才能让它重新处理原始数据,使拇指在当前拇指尺寸参数中具有正确的尺寸?

更新:我找到了回形针中包含的attachment.rb。有趣的是像 .save.updated_at 这样的方法可以工作。但 reprocess! 和其他一些方法则不然。有什么明显不正常的气味吗?

I have over time, changed the size for thumbs of the class Deal. Through these changes, users were uploading to the site, so there are few people who have different sized thumbs. I wanted to reprocress or refresh these, so I went to into my root and typed:

rake paperclip:refresh class=Deal

Did nothing for the thumb sizes.. Then I in script/console :

Deal.find(987).reprocess!

Returned this :

NoMethodError: undefined method `reprocess!' for #<Deal:0xb68a0988>
from /data/HQ_Channel/releases/20100607130346/vendor/rails/activerecord/lib/active_record/attribute_methods.rb:260:in `method_missing'
from (irb):7

My deal class is this :

=> Deal(id: integer, organization_id: integer, deal: string, value: string, what: string, description: string, image_file_name: string, image_content_type: string, image_file_size: integer, image_updated_at: datetime, created_at: datetime, updated_at: datetime, deal_image_file_name: string, deal_image_content_type: string, deal_image_file_size: integer, deal_image_uploaded_at: datetime)

What can i do to have it reprocess the original to make the thumb the correct size in the current thumb size params?

UPDATE: I have found the attachment.rb included with Paperclip. What's interesting is that methods like .save, and .updated_at work. But reprocess! and a few other methods do not. Does anything smell obviously out of place?

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(2

毁我热情 2024-09-11 23:46:29

知道了!

这是因为回形针与模型的对象无关,而是与模型的对象的图像相关。写得正确的话,它会像这样工作:

Model.find(#).image.reprocess!

Got it!

It's because paperclip isn't relative to the Model's object, but rather the Model's object's image. So written proper, it would work like this :

Model.find(#).image.reprocess!
秋叶绚丽 2024-09-11 23:46:29

您还可以使用附带的 Rake 任务:

$ rake paperclip:refresh CLASS=Deal

请参阅 Paperclip Wiki

You can also use the included Rake task:

$ rake paperclip:refresh CLASS=Deal

See Paperclip Wiki

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文