繁体   English   中英

如何在Activeadmin中管理使用托管在AWS上的refile gem上载的照片。 滑轨

[英]How to manage photos uploaded with refile gem hosted on AWS within Activeadmin. Rails

我有一个使用refile上传多个图像的Rails应用程序。 我希望能够为Activeadmin中的所有用户管理这些图像,因此,如果有人要上传令人反感的照片,我可以通过activeadmin将其从其个人资料中删除。 我不知道提到这些照片托管在AWS上是否重要。

f.inputs "Attachment", :multipart => true do 
          f.input :images, :hint => image_tag(f.object.images.each_with_index do |image, index| 
                attachment_image_tag(image, :file, :fit, 600, 600)

              end)
        end

我一直在尝试此代码,只是将照片的所有详细信息取回来,例如上载时间,ID和上次更新时间。 这是我在网上找到的唯一帮助,但是并不能满足我的需要。 https://github.com/activeadmin/activeadmin/wiki/Showing-an-uploaded-image-in-the-form

这个问题的任何帮助将是巨大的。 谢谢!

我最终弄清楚了。

    f.inputs "Images" do
        ul do
            f.label "Click on the images you want to delete, The page will not automatically refresh however the image is being deleted!!"
                f.object.images.each do |img|
                    li do
                        link_to img, remote: true, label: :remove_image, method: :delete do
                            attachment_image_tag(img, :file, :fill, 100, 100)
                        end
                    end

                end
            end

        end

在模型中,我输入:

def编辑@images = Ambassador.images

结束

暂无
暂无

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM