activestorage 8.0.1 → 8.0.2
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- checksums.yaml +4 -4
- data/CHANGELOG.md +20 -0
- data/app/models/active_storage/blob.rb +1 -17
- data/lib/active_storage/attached/changes/create_one.rb +1 -1
- data/lib/active_storage/attached/model.rb +21 -2
- data/lib/active_storage/gem_version.rb +1 -1
- metadata +14 -17
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 4bbf84572249cd095f129f72e311fa2006f6a638bd0fcbecb30a821c67181169
|
4
|
+
data.tar.gz: d1cbd96bb36d8030b4a77342f22db20de364964d981936246b4d29111554bbcb
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 606c383b9ff07f33678176a77bee416666079c0f55ffa5abad030dd3fb1f80deb7bc37ab3f3ece431ec6501161bc310a3cf53e2f352be94ae2d627166d02e4fd
|
7
|
+
data.tar.gz: 19ea5d15b1226baea7984b9229bb0a24c82bbe89f24194c6193abcaf7dbb4544801e2ffc60f0c00240b7bd6e19293357263c6a40f9d3baa126ea7cb0ac318c37
|
data/CHANGELOG.md
CHANGED
@@ -1,3 +1,23 @@
|
|
1
|
+
## Rails 8.0.2 (March 12, 2025) ##
|
2
|
+
|
3
|
+
* No changes.
|
4
|
+
|
5
|
+
|
6
|
+
## Rails 8.0.2 (March 12, 2025) ##
|
7
|
+
|
8
|
+
* A Blob will no longer autosave associated Attachment.
|
9
|
+
|
10
|
+
This fixes an issue where a record with an attachment would have
|
11
|
+
its dirty attributes reset, preventing your `after commit` callbacks
|
12
|
+
on that record to behave as expected.
|
13
|
+
|
14
|
+
Note that this change doesn't require any changes on your application
|
15
|
+
and is supposed to be internal. Active Storage Attachment will continue
|
16
|
+
to be autosaved (through a different relation).
|
17
|
+
|
18
|
+
*Edouard-chin*
|
19
|
+
|
20
|
+
|
1
21
|
## Rails 8.0.1 (December 13, 2024) ##
|
2
22
|
|
3
23
|
* No changes.
|
@@ -29,7 +29,7 @@ class ActiveStorage::Blob < ActiveStorage::Record
|
|
29
29
|
# :method:
|
30
30
|
#
|
31
31
|
# Returns the associated ActiveStorage::Attachment instances.
|
32
|
-
has_many :attachments
|
32
|
+
has_many :attachments, autosave: false
|
33
33
|
|
34
34
|
##
|
35
35
|
# :singleton-method:
|
@@ -151,22 +151,6 @@ class ActiveStorage::Blob < ActiveStorage::Record
|
|
151
151
|
combined_blob.save!
|
152
152
|
end
|
153
153
|
end
|
154
|
-
|
155
|
-
def validate_service_configuration(service_name, model_class, association_name) # :nodoc:
|
156
|
-
if service_name
|
157
|
-
services.fetch(service_name) do
|
158
|
-
raise ArgumentError, "Cannot configure service #{service_name.inspect} for #{model_class}##{association_name}"
|
159
|
-
end
|
160
|
-
else
|
161
|
-
validate_global_service_configuration
|
162
|
-
end
|
163
|
-
end
|
164
|
-
|
165
|
-
def validate_global_service_configuration # :nodoc:
|
166
|
-
if connected? && table_exists? && Rails.configuration.active_storage.service.nil?
|
167
|
-
raise RuntimeError, "Missing Active Storage service name. Specify Active Storage service name for config.active_storage.service in config/environments/#{Rails.env}.rb"
|
168
|
-
end
|
169
|
-
end
|
170
154
|
end
|
171
155
|
|
172
156
|
include Analyzable
|
@@ -121,7 +121,7 @@ module ActiveStorage
|
|
121
121
|
service_name = record.attachment_reflections[name].options[:service_name]
|
122
122
|
if service_name.is_a?(Proc)
|
123
123
|
service_name = service_name.call(record)
|
124
|
-
|
124
|
+
Attached::Model.validate_service_configuration(service_name, record.class, name)
|
125
125
|
end
|
126
126
|
service_name
|
127
127
|
end
|
@@ -106,7 +106,7 @@ module ActiveStorage
|
|
106
106
|
# <tt>active_storage_attachments.record_type</tt> polymorphic type column of
|
107
107
|
# the corresponding rows.
|
108
108
|
def has_one_attached(name, dependent: :purge_later, service: nil, strict_loading: false)
|
109
|
-
|
109
|
+
Attached::Model.validate_service_configuration(service, self, name) unless service.is_a?(Proc)
|
110
110
|
|
111
111
|
generated_association_methods.class_eval <<-CODE, __FILE__, __LINE__ + 1
|
112
112
|
# frozen_string_literal: true
|
@@ -208,7 +208,7 @@ module ActiveStorage
|
|
208
208
|
# <tt>active_storage_attachments.record_type</tt> polymorphic type column of
|
209
209
|
# the corresponding rows.
|
210
210
|
def has_many_attached(name, dependent: :purge_later, service: nil, strict_loading: false)
|
211
|
-
|
211
|
+
Attached::Model.validate_service_configuration(service, self, name) unless service.is_a?(Proc)
|
212
212
|
|
213
213
|
generated_association_methods.class_eval <<-CODE, __FILE__, __LINE__ + 1
|
214
214
|
# frozen_string_literal: true
|
@@ -259,6 +259,25 @@ module ActiveStorage
|
|
259
259
|
end
|
260
260
|
end
|
261
261
|
|
262
|
+
class << self
|
263
|
+
def validate_service_configuration(service_name, model_class, association_name) # :nodoc:
|
264
|
+
if service_name
|
265
|
+
ActiveStorage::Blob.services.fetch(service_name) do
|
266
|
+
raise ArgumentError, "Cannot configure service #{service_name.inspect} for #{model_class}##{association_name}"
|
267
|
+
end
|
268
|
+
else
|
269
|
+
validate_global_service_configuration(model_class)
|
270
|
+
end
|
271
|
+
end
|
272
|
+
|
273
|
+
private
|
274
|
+
def validate_global_service_configuration(model_class)
|
275
|
+
if model_class.connected? && ActiveStorage::Blob.table_exists? && Rails.configuration.active_storage.service.nil?
|
276
|
+
raise RuntimeError, "Missing Active Storage service name. Specify Active Storage service name for config.active_storage.service in config/environments/#{Rails.env}.rb"
|
277
|
+
end
|
278
|
+
end
|
279
|
+
end
|
280
|
+
|
262
281
|
def attachment_changes # :nodoc:
|
263
282
|
@attachment_changes ||= {}
|
264
283
|
end
|
metadata
CHANGED
@@ -1,14 +1,13 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: activestorage
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 8.0.
|
4
|
+
version: 8.0.2
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- David Heinemeier Hansson
|
8
|
-
autorequire:
|
9
8
|
bindir: bin
|
10
9
|
cert_chain: []
|
11
|
-
date:
|
10
|
+
date: 2025-03-12 00:00:00.000000000 Z
|
12
11
|
dependencies:
|
13
12
|
- !ruby/object:Gem::Dependency
|
14
13
|
name: activesupport
|
@@ -16,56 +15,56 @@ dependencies:
|
|
16
15
|
requirements:
|
17
16
|
- - '='
|
18
17
|
- !ruby/object:Gem::Version
|
19
|
-
version: 8.0.
|
18
|
+
version: 8.0.2
|
20
19
|
type: :runtime
|
21
20
|
prerelease: false
|
22
21
|
version_requirements: !ruby/object:Gem::Requirement
|
23
22
|
requirements:
|
24
23
|
- - '='
|
25
24
|
- !ruby/object:Gem::Version
|
26
|
-
version: 8.0.
|
25
|
+
version: 8.0.2
|
27
26
|
- !ruby/object:Gem::Dependency
|
28
27
|
name: actionpack
|
29
28
|
requirement: !ruby/object:Gem::Requirement
|
30
29
|
requirements:
|
31
30
|
- - '='
|
32
31
|
- !ruby/object:Gem::Version
|
33
|
-
version: 8.0.
|
32
|
+
version: 8.0.2
|
34
33
|
type: :runtime
|
35
34
|
prerelease: false
|
36
35
|
version_requirements: !ruby/object:Gem::Requirement
|
37
36
|
requirements:
|
38
37
|
- - '='
|
39
38
|
- !ruby/object:Gem::Version
|
40
|
-
version: 8.0.
|
39
|
+
version: 8.0.2
|
41
40
|
- !ruby/object:Gem::Dependency
|
42
41
|
name: activejob
|
43
42
|
requirement: !ruby/object:Gem::Requirement
|
44
43
|
requirements:
|
45
44
|
- - '='
|
46
45
|
- !ruby/object:Gem::Version
|
47
|
-
version: 8.0.
|
46
|
+
version: 8.0.2
|
48
47
|
type: :runtime
|
49
48
|
prerelease: false
|
50
49
|
version_requirements: !ruby/object:Gem::Requirement
|
51
50
|
requirements:
|
52
51
|
- - '='
|
53
52
|
- !ruby/object:Gem::Version
|
54
|
-
version: 8.0.
|
53
|
+
version: 8.0.2
|
55
54
|
- !ruby/object:Gem::Dependency
|
56
55
|
name: activerecord
|
57
56
|
requirement: !ruby/object:Gem::Requirement
|
58
57
|
requirements:
|
59
58
|
- - '='
|
60
59
|
- !ruby/object:Gem::Version
|
61
|
-
version: 8.0.
|
60
|
+
version: 8.0.2
|
62
61
|
type: :runtime
|
63
62
|
prerelease: false
|
64
63
|
version_requirements: !ruby/object:Gem::Requirement
|
65
64
|
requirements:
|
66
65
|
- - '='
|
67
66
|
- !ruby/object:Gem::Version
|
68
|
-
version: 8.0.
|
67
|
+
version: 8.0.2
|
69
68
|
- !ruby/object:Gem::Dependency
|
70
69
|
name: marcel
|
71
70
|
requirement: !ruby/object:Gem::Requirement
|
@@ -190,12 +189,11 @@ licenses:
|
|
190
189
|
- MIT
|
191
190
|
metadata:
|
192
191
|
bug_tracker_uri: https://github.com/rails/rails/issues
|
193
|
-
changelog_uri: https://github.com/rails/rails/blob/v8.0.
|
194
|
-
documentation_uri: https://api.rubyonrails.org/v8.0.
|
192
|
+
changelog_uri: https://github.com/rails/rails/blob/v8.0.2/activestorage/CHANGELOG.md
|
193
|
+
documentation_uri: https://api.rubyonrails.org/v8.0.2/
|
195
194
|
mailing_list_uri: https://discuss.rubyonrails.org/c/rubyonrails-talk
|
196
|
-
source_code_uri: https://github.com/rails/rails/tree/v8.0.
|
195
|
+
source_code_uri: https://github.com/rails/rails/tree/v8.0.2/activestorage
|
197
196
|
rubygems_mfa_required: 'true'
|
198
|
-
post_install_message:
|
199
197
|
rdoc_options: []
|
200
198
|
require_paths:
|
201
199
|
- lib
|
@@ -210,8 +208,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
210
208
|
- !ruby/object:Gem::Version
|
211
209
|
version: '0'
|
212
210
|
requirements: []
|
213
|
-
rubygems_version: 3.
|
214
|
-
signing_key:
|
211
|
+
rubygems_version: 3.6.2
|
215
212
|
specification_version: 4
|
216
213
|
summary: Local and cloud file storage framework.
|
217
214
|
test_files: []
|