I have included an ActiveStorage attribute from my model in RailsAdmin as follows:
config.model 'Employee' do
list do
field :resume, :active_storage
end
end
This works but it displays the ActiveStorage object in the list view:
I would prefer to show the filename or some other text instead while still being able to click the text and download the file.
I figured it out as follows:
field :resume, :active_storage do
pretty_value do
if value
path = Rails.application.routes.url_helpers.rails_blob_path(value, only_path: true)
bindings[:view].content_tag(:a, value.filename, href: path)
end
end