如何使用回形针复制文件

发布于 2024-08-31 03:55:06 字数 77 浏览 1 评论 0原文

有谁知道使用 S3 进行存储并使用 Paperclip 复制文件的方法吗?在我尝试编写自己的代码之前,我只是想确保还没有办法做到这一点。谢谢

Does anyone know of a way to copy files with Paperclip using S3 for storage? Before I try to write my own, I just wanted to make sure there wasn't already a way to do this. Thanks

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

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

发布评论

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

评论(1

司马昭之心 2024-09-07 03:55:06

经过一番用回形针摆弄之后,我明白了。复制文件非常简单!

# Stupid example method that just copies a user's profile pic to another user.
def copy_profile_picture(user_1, user_2)
  user_2.picture = user_1.picture
  user_2.save # Copied the picture and we're done!
end

这也适用于 amazon s3。甜的

After some more messing around with paperclip, I figured it out. It's ridiculously simple to copy files!

# Stupid example method that just copies a user's profile pic to another user.
def copy_profile_picture(user_1, user_2)
  user_2.picture = user_1.picture
  user_2.save # Copied the picture and we're done!
end

This also works great with amazon s3. Sweet

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