簡體   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