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 CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: '0039f175e4f3348c3a168c81529baab2cd200eb75bbf69e7470d73d05d1c3336'
4
- data.tar.gz: 972e99f9f1a92ad432abfbf950b45f1f14542b0b9fbfadfe979038da40fd92e2
3
+ metadata.gz: 5fe68cdcdd95be540a5ecdc2536daf6f48d0057a7c250baff8cb7be6de0189ca
4
+ data.tar.gz: 81ec78bc141338cf5706400477345ca200a181ebe7ab0d03e848c48a58a85f3a
5
5
  SHA512:
6
- metadata.gz: b2c43d55f3eb96fc53b14d5c60d25b1b7cd600181a359b5d32e0b25366bba7e6e738398cc6f44f4e089c328d05a4b53d19d96479a58dfc795d1f52bb33a1156c
7
- data.tar.gz: 470a6b3ed0cc27e7a86efb5678644e919b8c0118c2c81cd7b678b485b9d0551852dd4480b85bb82f1e14bcd6482121aaa96b027ebf974c838461c42c165e3447
6
+ metadata.gz: 0a66a9a839e9e413de27bd6560fb0ca3fd55a79d4f7c85ab7f7e5d2d7883deaee805065aee9e47fa49403f04cf027478095f66de42e1521f8337d635959b4a56
7
+ data.tar.gz: daeb8ab8f22c2532645814e8d4a7548050629620671a46b340c25e294abb673e151a0291b1cfe1f1f7821bd752119459fa721509085008a2fffbb9b7bab05d00
data/Gemfile.lock CHANGED
@@ -1,7 +1,7 @@
1
1
  PATH
2
2
  remote: .
3
3
  specs:
4
- activestorage-delayed (0.2.0)
4
+ activestorage-delayed (0.3.5)
5
5
  activestorage
6
6
  rails
7
7
 
@@ -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.each(&method(:upload_photo))
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
- return block.call(io) unless variant_info
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
@@ -1,5 +1,5 @@
1
1
  # frozen_string_literal: true
2
2
 
3
3
  module ActivestorageDelayed
4
- VERSION = '0.3.3'
4
+ VERSION = '0.3.5'
5
5
  end
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.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-10-04 00:00:00.000000000 Z
11
+ date: 2022-11-25 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: activestorage