Display first of several images in the grid #961
Answered
by
adrianthedev
iainbeeston
asked this question in
Help
-
I have a resource that has a My resource looks like this:
Is there an easy way to pick just one of the files for a cover image? |
Beta Was this translation helpful? Give feedback.
Answered by
adrianthedev
Jun 14, 2022
Replies: 1 comment 1 reply
-
I managed to get it working. You need to make a few changes:
grid do
cover :cover_photo, as: :external_image, is_image: true, link_to_resource: true do |model|
if model.images.first.present?
main_app.url_for(model.images.first)
else
""
end
end
# title
# #body
end Please let me know if that fixed it 🤙 |
Beta Was this translation helpful? Give feedback.
1 reply
Answer selected by
iainbeeston
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
I managed to get it working. You need to make a few changes:
external_image
main_app.url_for(model.images.first)
. We callurl_for
with the image, and we need to call it on themain_app
because we're executing it inside a Rails engine.Please let me know if that fixed it 🤙