activestorage-delayed 0.3.3 → 0.3.5
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/Gemfile.lock +1 -1
- data/lib/activestorage-delayed/delayed_uploader.rb +5 -7
- data/lib/activestorage-delayed/version.rb +1 -1
- metadata +2 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 5fe68cdcdd95be540a5ecdc2536daf6f48d0057a7c250baff8cb7be6de0189ca
|
4
|
+
data.tar.gz: 81ec78bc141338cf5706400477345ca200a181ebe7ab0d03e848c48a58a85f3a
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 0a66a9a839e9e413de27bd6560fb0ca3fd55a79d4f7c85ab7f7e5d2d7883deaee805065aee9e47fa49403f04cf027478095f66de42e1521f8337d635959b4a56
|
7
|
+
data.tar.gz: daeb8ab8f22c2532645814e8d4a7548050629620671a46b340c25e294abb673e151a0291b1cfe1f1f7821bd752119459fa721509085008a2fffbb9b7bab05d00
|
data/Gemfile.lock
CHANGED
@@ -13,14 +13,13 @@ module ActivestorageDelayed
|
|
13
13
|
return unless delayed_upload
|
14
14
|
|
15
15
|
remove_files
|
16
|
-
upload_photos
|
17
|
-
save_changes
|
16
|
+
save_changes if upload_photos
|
18
17
|
end
|
19
18
|
|
20
19
|
private
|
21
20
|
|
22
21
|
def upload_photos
|
23
|
-
tmp_files_data.
|
22
|
+
tmp_files_data.map(&method(:upload_photo)).all?
|
24
23
|
end
|
25
24
|
|
26
25
|
def upload_photo(file_data)
|
@@ -29,8 +28,9 @@ module ActivestorageDelayed
|
|
29
28
|
model.send(attr_name).attach(file_data.transform_keys(&:to_sym))
|
30
29
|
model.send("#{attr_name}_after_upload", file_data)
|
31
30
|
end
|
31
|
+
true
|
32
32
|
rescue => e # rubocop:disable Style/RescueStandardError
|
33
|
-
print_failure(e, file_data)
|
33
|
+
e.message.include?('PG::UniqueViolation:') ? raise : print_failure(e, file_data) && false
|
34
34
|
end
|
35
35
|
|
36
36
|
def print_failure(error, file_data = {})
|
@@ -72,9 +72,7 @@ module ActivestorageDelayed
|
|
72
72
|
# @param io [StringIO, File]
|
73
73
|
# @param variant_info [Hash, Nil] ActiveStorage variant info. Sample: { resize_to_fit: [400, 400], convert: 'jpg' }
|
74
74
|
def transform_variation(io, variant_info, &block)
|
75
|
-
|
76
|
-
|
77
|
-
ActiveStorage::Variation.wrap(variant_info).transform(io, &block)
|
75
|
+
variant_info ? ActiveStorage::Variation.wrap(variant_info).transform(io, &block) : block.call(io)
|
78
76
|
end
|
79
77
|
|
80
78
|
def model
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: activestorage-delayed
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.3.
|
4
|
+
version: 0.3.5
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Owen Peredo Diaz
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2022-
|
11
|
+
date: 2022-11-25 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: activestorage
|