Skip to content

Commit 6b83899

Browse files
committed
Delegate to ActiveStorage to generate URLs for blobs
1 parent f54a102 commit 6b83899

File tree

2 files changed

+4
-8
lines changed

2 files changed

+4
-8
lines changed

lib/rails_admin/config/fields/types/active_storage.rb

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -51,11 +51,9 @@ def resource_url(thumb = false)
5151
if thumb && value.representable?
5252
thumb = thumb_method if thumb == true
5353
representation = value.representation(thumb)
54-
Rails.application.routes.url_helpers.rails_blob_representation_path(
55-
representation.blob.signed_id, representation.variation.key, representation.blob.filename, only_path: true
56-
)
54+
representation.processed.url
5755
else
58-
Rails.application.routes.url_helpers.rails_blob_path(value, only_path: true)
56+
value.url
5957
end
6058
end
6159

lib/rails_admin/config/fields/types/multiple_active_storage.rb

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -31,11 +31,9 @@ def resource_url(thumb = false)
3131

3232
if thumb && value.representable?
3333
representation = value.representation(thumb_method)
34-
Rails.application.routes.url_helpers.rails_blob_representation_path(
35-
representation.blob.signed_id, representation.variation.key, representation.blob.filename, only_path: true
36-
)
34+
representation.processed.url
3735
else
38-
Rails.application.routes.url_helpers.rails_blob_path(value, only_path: true)
36+
value.url
3937
end
4038
end
4139
end

0 commit comments

Comments
 (0)