Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Multiple upload images in active_admin with Active Storage

I found useful article about uploading image using Active Storage in activeadmin: https://medium.com/@maris.cilitis/using-ruby-on-rails-active-storage-image-uploads-for-active-admin-backed-resources-5638a9ca0b46

But how to upload multiple images in activeadmin with Active Storage the same way?

like image 808
Postanova Avatar asked Jun 04 '18 18:06

Postanova


1 Answers

You just need do some changes

model:

has_many_attached :images

instead of

has_one_attached :image

activeadmin:

permit_params images: []

form do |f|
  f.inputs do
    f.input :images, as: :file, input_html: { multiple: true }
  end
end

and you'll can choose many files to upload

like image 129
Alex Avatar answered Oct 19 '22 20:10

Alex