1
votes

How do i display my images in the rails admin view, edit and show actions?

Here is my code

rails_admin.rb

config.model 'Event' do
    edit do
      field :images, :multiple_active_storage
    end
    list do
      configure :images
    end
  end

events.rb

class Event < ApplicationRecord
  has_many_attached :images
 end

With the above code, I can successfully upload images in rails admin dashboard but the images don't display. It displays the missing image icons

How can I fix it? If possible I will like to have different images sizes for the show and listing views in the rails admin dashboard

Thanks

1

1 Answers

-1
votes

You can display the images with:

<% event.images.each do |image|
  <%= image_tag url_for(image) %>
<% end %>