Rails has a column called image_url in the model, how do I display this image in the index of ActiveAdmin?
ruby-on-rails activeadmin
When the model is named stack,
index do
column :id
column "Image" do |stack|
if !stack.image_url.nil?
image_tag stack.image_url, class: 'stack_image'
end
end
#Other column information...
Hani works well.
If the width is not determined through class 'stack_image', it will be displayed as the original image size, so it is convenient to specify the size in active_admin.scss.
© 2024 OneMinuteCode. All rights reserved.