Skip to content

Commit 0e40ca7

Browse files
authored
Fix type parameter support in ActiveStorage service
1 parent 39d530b commit 0e40ca7

File tree

2 files changed

+13
-2
lines changed

2 files changed

+13
-2
lines changed

lib/active_storage/service/cloudinary_service.rb

Lines changed: 12 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -95,7 +95,12 @@ def headers_for_direct_upload(key, content_type:, checksum:, **)
9595

9696
def delete(key)
9797
instrument :delete, key: key do
98-
Cloudinary::Uploader.destroy public_id(key), resource_type: resource_type(nil, key)
98+
options = {
99+
resource_type: resource_type(nil, key),
100+
type: @options[:type]
101+
}.compact
102+
103+
Cloudinary::Uploader.destroy public_id(key), **options
99104
end
100105
end
101106

@@ -107,7 +112,12 @@ def delete_prefixed(prefix)
107112
def exist?(key)
108113
instrument :exist, key: key do |payload|
109114
begin
110-
Cloudinary::Api.resource public_id(key), resource_type: resource_type(nil, key)
115+
options = {
116+
resource_type: resource_type(nil, key),
117+
type: @options[:type]
118+
}.compact
119+
120+
Cloudinary::Api.resource public_id(key), **options
111121
true
112122
rescue Cloudinary::Api::NotFound => e
113123
false
Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,6 @@
11
cloudinary:
22
service: Cloudinary
3+
type: authenticated
34
tags:
45
- ActiveStorageTestTag
56
folder: active_storage_test_folder

0 commit comments

Comments
 (0)