Reputation: 590
I have an Event Model which as many images fields
class Event < ApplicationRecord
has_one_attached :poster
has_one_attached :ticket_image
has_many_attached :images
end
How can I create and permit images on active admin events dashboard with the above fields? I am using active_storage as my image uploader
Upvotes: 3
Views: 2203
Reputation: 21
Try something like this:
ActiveAdmin.register Event do
...
form do |f|
input :poster, as: :file
input :ticket_image, as: :file
input :images, as: :file, input_html: { multiple: true }
end
permit_params :poster, :ticket_image, images: []
end
Upvotes: 2