active_storage_base64 2.0.0 → 3.0.0

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: 7f6c1d529089b0f279a3772aa6dd1aa44dce8bc5b0eca8cbca52433a786bbc98
4
- data.tar.gz: fd92fb0cae792e16221301f59d346a73df4d60579f1f4dbb36235f29f6f242ae
3
+ metadata.gz: 2a0d75307a7c96973646ed02733a40ec52456aa67b81d75c24c5be6a1abda375
4
+ data.tar.gz: 64d5fcea8ef73cf23d7182f9ccefea8c70f2629a26b43f0b3eebb35c507cfd14
5
5
  SHA512:
6
- metadata.gz: c1def5ffac22e0f855862672df7f629d5bf0cbe77b1c5ceec49dc08aad849d9957a84f82357e664fb2d2d2feb2f7750416a340f4b0bcd5f90e4eb5fc8667d583
7
- data.tar.gz: bbf89ca79423cb55dca6ac6f8dbe4a4769725fcfa5d42dc85c842eb86e965336ef7a57d85bfaf296fd75959d6f79e3f0c1c2784b61d3dd425b8ef7dab735d270
6
+ metadata.gz: 7545063aa84f96ab54044370f0119b698c2c5b54a3951436d81b89352fc1e07fc242288151d2bc05187b7c6bffec287d40bee209f112686e78d9a97004b91aa8
7
+ data.tar.gz: 8b285b0c6d6d5c321b3afd6393f6f67b12167481e565d399a6f610878c8d87ae755284140b2f6119498178754916992069a02222ce2d83c4ff40fcb348b40132
data/README.md CHANGED
@@ -13,9 +13,18 @@ In order to get the gem working on your project you just need to add the gem to
13
13
  gem 'active_storage_base64'
14
14
  ```
15
15
 
16
+ ## Compatibility
17
+ Rails Version | ActiveStorageBase64 Version
18
+ --------------|-----------------------------
19
+ 7.1.x | 3.0.x
20
+ 7.0.x | 2.0.x
21
+ 6.1.x | 1.2.x
22
+ 6.0.x | 1.1.x
23
+ 5.2.x | 0.1.x
24
+
16
25
  ## Prerequisites
17
26
 
18
- The only prerequisites for using this gem are having Rails version 6.1 or higher installed on your project and having ActiveStorage properly set up (for more information on how to do this, check [Active Storage Overview](https://edgeguides.rubyonrails.org/active_storage_overview.html))
27
+ The only prerequisite for using this gem is having ActiveStorage properly set up in your project. For more information on how to do this, check [Active Storage Overview](https://edgeguides.rubyonrails.org/active_storage_overview.html).
19
28
 
20
29
  ## Usage
21
30
 
@@ -17,7 +17,7 @@ module ActiveStorageSupport
17
17
 
18
18
  def #{name}=(attachable)
19
19
  attachment_changes["#{name}"] =
20
- if attachable.nil?
20
+ if attachable.nil? || attachable == ""
21
21
  ActiveStorage::Attached::Changes::DeleteOne.new("#{name}", self)
22
22
  else
23
23
  ActiveStorage::Attached::Changes::CreateOne.new(
@@ -39,28 +39,15 @@ module ActiveStorageSupport
39
39
  end
40
40
 
41
41
  def #{name}=(attachables)
42
- if ActiveStorage.replace_on_assign_to_many
43
- attachment_changes["#{name}"] =
44
- if Array(attachables).none?
45
- ActiveStorage::Attached::Changes::DeleteMany.new("#{name}", self)
46
- else
47
- ActiveStorage::Attached::Changes::CreateMany.new(
48
- "#{name}", self, ActiveStorageSupport::Base64Many.from_base64(attachables)
49
- )
50
- end
51
- else
52
- ActiveSupport::Deprecation.warn \
53
- "config.active_storage.replace_on_assign_to_many is deprecated and will be removed in Rails 7.1. " \
54
- "Make sure that your code works well with config.active_storage.replace_on_assign_to_many set to true before upgrading. " \
55
- "To append new attachables to the Active Storage association, prefer using `attach`. " \
56
- "Using association setter would result in purging the existing attached attachments and replacing them with new ones."
42
+ attachables = Array(attachables).compact_blank
43
+ pending_uploads = attachment_changes["#{name}"].try(:pending_uploads)
57
44
 
58
- if Array(attachables).any?
59
- attachment_changes["#{name}"] =
60
- ActiveStorage::Attached::Changes::CreateMany.new(
61
- "#{name}", self, #{name}.blobs + ActiveStorageSupport::Base64Many.from_base64(attachables)
62
- )
63
- end
45
+ attachment_changes["#{name}"] = if attachables.none?
46
+ ActiveStorage::Attached::Changes::DeleteMany.new("#{name}", self)
47
+ else
48
+ ActiveStorage::Attached::Changes::CreateMany.new(
49
+ "#{name}", self, ActiveStorageSupport::Base64Many.from_base64(attachables), pending_uploads: pending_uploads
50
+ )
64
51
  end
65
52
  end
66
53
  CODE
metadata CHANGED
@@ -1,28 +1,56 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: active_storage_base64
3
3
  version: !ruby/object:Gem::Version
4
- version: 2.0.0
4
+ version: 3.0.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Ricardo Cortio
8
8
  - Santiago Bartesaghi
9
- autorequire:
9
+ autorequire:
10
10
  bindir: bin
11
11
  cert_chain: []
12
- date: 2021-12-23 00:00:00.000000000 Z
12
+ date: 2023-09-19 00:00:00.000000000 Z
13
13
  dependencies:
14
14
  - !ruby/object:Gem::Dependency
15
- name: rails
15
+ name: activestorage
16
+ requirement: !ruby/object:Gem::Requirement
17
+ requirements:
18
+ - - ">"
19
+ - !ruby/object:Gem::Version
20
+ version: '7.0'
21
+ type: :runtime
22
+ prerelease: false
23
+ version_requirements: !ruby/object:Gem::Requirement
24
+ requirements:
25
+ - - ">"
26
+ - !ruby/object:Gem::Version
27
+ version: '7.0'
28
+ - !ruby/object:Gem::Dependency
29
+ name: activesupport
16
30
  requirement: !ruby/object:Gem::Requirement
17
31
  requirements:
18
- - - ">="
32
+ - - ">"
19
33
  - !ruby/object:Gem::Version
20
34
  version: '7.0'
21
35
  type: :runtime
22
36
  prerelease: false
23
37
  version_requirements: !ruby/object:Gem::Requirement
24
38
  requirements:
25
- - - ">="
39
+ - - ">"
40
+ - !ruby/object:Gem::Version
41
+ version: '7.0'
42
+ - !ruby/object:Gem::Dependency
43
+ name: rails
44
+ requirement: !ruby/object:Gem::Requirement
45
+ requirements:
46
+ - - ">"
47
+ - !ruby/object:Gem::Version
48
+ version: '7.0'
49
+ type: :development
50
+ prerelease: false
51
+ version_requirements: !ruby/object:Gem::Requirement
52
+ requirements:
53
+ - - ">"
26
54
  - !ruby/object:Gem::Version
27
55
  version: '7.0'
28
56
  - !ruby/object:Gem::Dependency
@@ -142,7 +170,7 @@ homepage: https://github.com/rootstrap/active-storage-base64
142
170
  licenses:
143
171
  - MIT
144
172
  metadata: {}
145
- post_install_message:
173
+ post_install_message:
146
174
  rdoc_options: []
147
175
  require_paths:
148
176
  - lib
@@ -157,8 +185,8 @@ required_rubygems_version: !ruby/object:Gem::Requirement
157
185
  - !ruby/object:Gem::Version
158
186
  version: '0'
159
187
  requirements: []
160
- rubygems_version: 3.0.3
161
- signing_key:
188
+ rubygems_version: 3.4.6
189
+ signing_key:
162
190
  specification_version: 4
163
191
  summary: Base64 support for ActiveStorage
164
192
  test_files: []