New Discussion

Notifications

You’re not receiving notifications from this thread.

How do I upload images using (Administrate Gem + ActiveStorage + Rails 6)

2
Rails

Hey Everyone I'm working on rails 6 and building an admin panel using Administrate Gem. I have a product model "has_many_attached :images"
but administrate does not recognizing:
images_attachments: Field::HasMany.with_options(class_name: "ActiveStorage::Attachment"),
images_blobs: Field::HasMany.with_options(class_name: "ActiveStorage::Blob"),
And Showing me text filed instead of file upload.
And I have also tried administrate-field-active_storage gem but when I tried to upload image, after everything i followed mention in Gem's doc, Now It's giving me this error:
undefined method `each' for #ActionDispatch::Http::UploadedFile:0x00007fa17c5af9e0

please advise me any direction.

Hey Fahad,

Try using this gem to add ActiveStorage support instead: https://github.com/Dreamersoul/administrate-field-active_storage

Hey, Fahad. I was wondering if you figure this issue out? I am currently trying to do the same but I'm getting the following error after using https://github.com/Dreamersoul/administrate-field-active_storage:

undefined method `attachment' for #Foo:0x00007fb9408234c0

Any idea on how to proceed? thanks.

Join the discussion
Create an account Log in

Learning Ruby on Rails? Join our newsletter.

We won't send you spam. Unsubscribe at any time.