activestorage 7.0.10 → 7.1.0.beta1

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.

Potentially problematic release.


This version of activestorage might be problematic. Click here for more details.

Files changed (55) hide show
  1. checksums.yaml +4 -4
  2. data/CHANGELOG.md +123 -381
  3. data/MIT-LICENSE +1 -1
  4. data/README.md +5 -5
  5. data/app/assets/javascripts/activestorage.esm.js +11 -7
  6. data/app/assets/javascripts/activestorage.js +12 -6
  7. data/app/controllers/active_storage/disk_controller.rb +4 -2
  8. data/app/controllers/active_storage/representations/proxy_controller.rb +1 -1
  9. data/app/controllers/concerns/active_storage/file_server.rb +4 -1
  10. data/app/javascript/activestorage/blob_record.js +4 -1
  11. data/app/javascript/activestorage/direct_upload.js +3 -2
  12. data/app/javascript/activestorage/index.js +3 -1
  13. data/app/javascript/activestorage/ujs.js +3 -3
  14. data/app/jobs/active_storage/transform_job.rb +12 -0
  15. data/app/models/active_storage/attachment.rb +87 -13
  16. data/app/models/active_storage/blob/analyzable.rb +4 -3
  17. data/app/models/active_storage/blob/identifiable.rb +1 -0
  18. data/app/models/active_storage/blob/representable.rb +7 -3
  19. data/app/models/active_storage/blob.rb +44 -50
  20. data/app/models/active_storage/current.rb +0 -10
  21. data/app/models/active_storage/filename.rb +2 -0
  22. data/app/models/active_storage/named_variant.rb +21 -0
  23. data/app/models/active_storage/preview.rb +6 -8
  24. data/app/models/active_storage/variant.rb +8 -3
  25. data/app/models/active_storage/variant_with_record.rb +16 -11
  26. data/app/models/active_storage/variation.rb +5 -3
  27. data/db/migrate/20170806125915_create_active_storage_tables.rb +1 -1
  28. data/lib/active_storage/analyzer/audio_analyzer.rb +16 -4
  29. data/lib/active_storage/analyzer/image_analyzer.rb +2 -0
  30. data/lib/active_storage/analyzer/video_analyzer.rb +3 -1
  31. data/lib/active_storage/analyzer.rb +2 -0
  32. data/lib/active_storage/attached/changes/create_many.rb +8 -3
  33. data/lib/active_storage/attached/changes/create_one.rb +14 -2
  34. data/lib/active_storage/attached/many.rb +5 -4
  35. data/lib/active_storage/attached/model.rb +59 -42
  36. data/lib/active_storage/attached/one.rb +5 -4
  37. data/lib/active_storage/attached.rb +2 -0
  38. data/lib/active_storage/deprecator.rb +7 -0
  39. data/lib/active_storage/engine.rb +11 -7
  40. data/lib/active_storage/fixture_set.rb +2 -4
  41. data/lib/active_storage/gem_version.rb +4 -4
  42. data/lib/active_storage/log_subscriber.rb +12 -0
  43. data/lib/active_storage/previewer.rb +8 -1
  44. data/lib/active_storage/reflection.rb +3 -3
  45. data/lib/active_storage/service/azure_storage_service.rb +2 -0
  46. data/lib/active_storage/service/disk_service.rb +2 -0
  47. data/lib/active_storage/service/gcs_service.rb +11 -20
  48. data/lib/active_storage/service/mirror_service.rb +10 -5
  49. data/lib/active_storage/service/s3_service.rb +2 -0
  50. data/lib/active_storage/service.rb +4 -2
  51. data/lib/active_storage/transformers/transformer.rb +2 -0
  52. data/lib/active_storage/version.rb +1 -1
  53. data/lib/active_storage.rb +19 -3
  54. metadata +22 -31
  55. data/app/models/active_storage/blob/servable.rb +0 -22
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: da49aa47055520b04928ebc44c40602bafba1df5f9d6dfa589dc6ac34e6a9f0c
4
- data.tar.gz: b8a00c49cf73ac4309f4654974ab21497ca97cdf845097a872c878f7dc3dfb6a
3
+ metadata.gz: 5dfb6f1b9694161b8a664871f19104256c481525dbcd52a738137c2fdb0e7c55
4
+ data.tar.gz: f72483c9153ef5bae19222f6ccb659d7d6ee0444d8785a00f9fa54c12f0a861b
5
5
  SHA512:
6
- metadata.gz: d1e840853a1250ebab5a2d19faef9a2f5afaebdfcaf99b15f0f6b3a5c7ec3ea3ac527e072fb800ae2f6559e7edd6aa128ba69acb08e25d86afb523a080c64ba3
7
- data.tar.gz: 8e6a839987b91f76cce8d1630e0690d574bbb0cc752c211a24206c596fe9bee443907727abb314f34ce692b8af291cc669919034c9aad8915bf6f48e81c8ac85
6
+ metadata.gz: c7fb7bd0ff896ca2f063a71cbc2187659b14b819d6899c23c48ad43ce54f4a48a4039c027e7802a551986b9f0cbde296e4acf9f633aacaf886a3608a3902a07d
7
+ data.tar.gz: 438c8ad07e00b2bdcee84b781bf764fb4c209999e3ccb757b41c5c7c4b9d32f26ea5c36b8f820bd7f1c3b1901ae088448e92b09ff340528636eef841a62df7f4
data/CHANGELOG.md CHANGED
@@ -1,29 +1,34 @@
1
- ## Rails 7.0.10 (October 28, 2025) ##
2
-
3
- * No changes.
1
+ ## Rails 7.1.0.beta1 (September 13, 2023) ##
4
2
 
3
+ * Disables the session in `ActiveStorage::Blobs::ProxyController`
4
+ and `ActiveStorage::Representations::ProxyController`
5
+ in order to allow caching by default in some CDNs as CloudFlare
5
6
 
6
- ## Rails 7.0.9 (October 28, 2025) ##
7
+ Fixes #44136
7
8
 
8
- * Fix `ActiveStorage::Representations::ProxyController` not returning the proper
9
- preview image variant for previewable files.
9
+ *Bruno Prieto*
10
10
 
11
- *Chedli Bourguiba*
11
+ * Add `tags` to `ActiveStorage::Analyzer::AudioAnalyzer` output
12
12
 
13
- * Make untracked variants obey `config.active_storage.content_types_to_serve_as_binary`
14
- and `config.active_storage.content_types_allowed_inline`.
13
+ *Keaton Roux*
15
14
 
16
- *Chedli Bourguiba* and *Jonathan Hefner*
15
+ * Add an option to preprocess variants
17
16
 
18
- * Fix direct upload forms when submit button contains nested elements.
17
+ ActiveStorage variants are processed on the fly when they are needed but
18
+ sometimes we're sure that they are accessed and want to processed them
19
+ upfront.
19
20
 
20
- *Marc Köhlbrugge*
21
+ `preprocessed` option is added when declaring variants.
21
22
 
22
- * Prevent `ActiveRecord::StrictLoadingViolationError` when strict loading is
23
- enabled and the variant of an Active Storage preview has already been
24
- processed (for example, by calling `ActiveStorage::Preview#url`).
23
+ ```
24
+ class User < ApplicationRecord
25
+ has_one_attached :avatar do |attachable|
26
+ attachable.variant :thumb, resize_to_limit: [100, 100], preprocessed: true
27
+ end
28
+ end
29
+ ```
25
30
 
26
- *Jonathan Hefner*
31
+ *Shouichi Kamiya*
27
32
 
28
33
  * Fix variants not included when eager loading multiple records containing a single attachment
29
34
 
@@ -32,68 +37,72 @@
32
37
 
33
38
  *Russell Porter*
34
39
 
40
+ * Allow an ActiveStorage attachment to be removed via a form post
35
41
 
36
- ## Rails 7.0.8.7 (December 10, 2024) ##
37
-
38
- * No changes.
39
-
40
-
41
- ## Rails 7.0.8.6 (October 23, 2024) ##
42
-
43
- * No changes.
44
-
45
-
46
- ## Rails 7.0.8.5 (October 15, 2024) ##
47
-
48
- * No changes.
49
-
50
-
51
- ## Rails 7.0.8.4 (June 04, 2024) ##
42
+ Attachments can already be removed by updating the attachment to be nil such as:
43
+ ```ruby
44
+ User.find(params[:id]).update!(avatar: nil)
45
+ ```
52
46
 
53
- * No changes.
47
+ However, a form cannot post a nil param, it can only post an empty string. But, posting an
48
+ empty string would result in an `ActiveSupport::MessageVerifier::InvalidSignature: mismatched digest`
49
+ error being raised, because it's being treated as a signed blob id.
54
50
 
51
+ Now, nil and an empty string are treated as a delete, which allows attachments to be removed via:
52
+ ```ruby
53
+ User.find(params[:id]).update!(params.require(:user).permit(:avatar))
55
54
 
56
- ## Rails 7.0.8.3 (May 17, 2024) ##
55
+ ```
57
56
 
58
- * No changes.
57
+ *Nate Matykiewicz*
59
58
 
59
+ * Remove mini_mime usage in favour of marcel.
60
60
 
61
- ## Rails 7.0.8.2 (May 16, 2024) ##
61
+ We have two libraries that are have similar usage. This change removes
62
+ dependency on mini_mime and makes use of similar methods from marcel.
62
63
 
63
- * No changes.
64
+ *Vipul A M*
64
65
 
66
+ * Allow destroying active storage variants
65
67
 
66
- ## Rails 7.0.8.1 (February 21, 2024) ##
68
+ ```ruby
69
+ User.first.avatar.variant(resize_to_limit: [100, 100]).destroy
70
+ ```
67
71
 
68
- * Disables the session in `ActiveStorage::Blobs::ProxyController`
69
- and `ActiveStorage::Representations::ProxyController`
70
- in order to allow caching by default in some CDNs as CloudFlare
72
+ *Shouichi Kamiya*, *Yuichiro NAKAGAWA*, *Ryohei UEDA*
71
73
 
72
- Fixes #44136
74
+ * Add `sample_rate` to `ActiveStorage::Analyzer::AudioAnalyzer` output
73
75
 
74
- *Bruno Prieto*
76
+ *Matija Čupić*
75
77
 
76
- ## Rails 7.0.8 (September 09, 2023) ##
78
+ * Remove deprecated `purge` and `purge_later` methods from the attachments association.
77
79
 
78
- * No changes.
80
+ *Rafael Mendonça França*
79
81
 
82
+ * Remove deprecated behavior when assigning to a collection of attachments.
80
83
 
81
- ## Rails 7.0.7.2 (August 22, 2023) ##
84
+ Instead of appending to the collection, the collection is now replaced.
82
85
 
83
- * No changes.
86
+ *Rafael Mendonça França*
84
87
 
88
+ * Remove deprecated `ActiveStorage::Current#host` and `ActiveStorage::Current#host=` methods.
85
89
 
86
- ## Rails 7.0.7.1 (August 22, 2023) ##
90
+ *Rafael Mendonça França*
87
91
 
88
- * No changes.
92
+ * Remove deprecated invalid default content types in Active Storage configurations.
89
93
 
94
+ *Rafael Mendonça França*
90
95
 
91
- ## Rails 7.0.7 (August 09, 2023) ##
96
+ * Add missing preview event to `ActiveStorage::LogSubscriber`
92
97
 
93
- * No changes.
98
+ A `preview` event is being instrumented in `ActiveStorage::Previewer`.
99
+ However it was not added inside ActiveStorage's LogSubscriber class.
94
100
 
101
+ This will allow to have logs for when a preview happens
102
+ in the same fashion as all other ActiveStorage events such as
103
+ `upload` and `download` inside `Rails.logger`.
95
104
 
96
- ## Rails 7.0.6 (June 29, 2023) ##
105
+ *Chedli Bourguiba*
97
106
 
98
107
  * Fix retrieving rotation value from FFmpeg on version 5.0+.
99
108
 
@@ -104,35 +113,72 @@
104
113
 
105
114
  *Haroon Ahmed*
106
115
 
116
+ * Touch all corresponding model records after ActiveStorage::Blob is analyzed
107
117
 
108
- ## Rails 7.0.5.1 (June 26, 2023) ##
118
+ This fixes a race condition where a record can be requested and have a cache entry built, before
119
+ the initial `analyze_later` completes, which will not be invalidated until something else
120
+ updates the record. This also invalidates cache entries when a blob is re-analyzed, which
121
+ is helpful if a bug is fixed in an analyzer or a new analyzer is added.
109
122
 
110
- * No changes.
123
+ *Nate Matykiewicz*
111
124
 
125
+ * Add ability to use pre-defined variants when calling `preview` or
126
+ `representation` on an attachment.
112
127
 
113
- ## Rails 7.0.5 (May 24, 2023) ##
128
+ ```ruby
129
+ class User < ActiveRecord::Base
130
+ has_one_attached :file do |attachable|
131
+ attachable.variant :thumb, resize_to_limit: [100, 100]
132
+ end
133
+ end
114
134
 
115
- * No changes.
135
+ <%= image_tag user.file.representation(:thumb) %>
136
+ ```
137
+
138
+ *Richard Böhme*
116
139
 
140
+ * Method `attach` always returns the attachments except when the record
141
+ is persisted, unchanged, and saving it fails, in which case it returns `nil`.
117
142
 
118
- ## Rails 7.0.4.3 (March 13, 2023) ##
143
+ *Santiago Bartesaghi*
119
144
 
120
- * No changes.
145
+ * Fixes multiple `attach` calls within transaction not uploading files correctly.
121
146
 
147
+ In the following example, the code failed to upload all but the last file to the configured service.
148
+ ```ruby
149
+ ActiveRecord::Base.transaction do
150
+ user.attachments.attach({
151
+ content_type: "text/plain",
152
+ filename: "dummy.txt",
153
+ io: ::StringIO.new("dummy"),
154
+ })
155
+ user.attachments.attach({
156
+ content_type: "text/plain",
157
+ filename: "dummy2.txt",
158
+ io: ::StringIO.new("dummy2"),
159
+ })
160
+ end
122
161
 
123
- ## Rails 7.0.4.2 (January 24, 2023) ##
162
+ assert_equal 2, user.attachments.count
163
+ assert user.attachments.first.service.exist?(user.attachments.first.key) # Fails
164
+ ```
124
165
 
125
- * No changes.
166
+ This was addressed by keeping track of the subchanges pending upload, and uploading them
167
+ once the transaction is committed.
126
168
 
169
+ Fixes #41661
127
170
 
128
- ## Rails 7.0.4.1 (January 17, 2023) ##
171
+ *Santiago Bartesaghi*, *Bruno Vezoli*, *Juan Roig*, *Abhay Nikam*
129
172
 
130
- * No changes.
173
+ * Raise an exception if `config.active_storage.service` is not set.
131
174
 
175
+ If Active Storage is configured and `config.active_storage.service` is not
176
+ set in the respective environment's configuration file, then an exception
177
+ is raised with a meaningful message when attempting to use Active Storage.
132
178
 
133
- ## Rails 7.0.4 (September 09, 2022) ##
179
+ *Ghouse Mohamed*
134
180
 
135
- * Fixes proxy downloads of files over 5MiB
181
+ * Fixes proxy downloads of files over 5mb
136
182
 
137
183
  Previously, trying to view and/or download files larger than 5mb stored in
138
184
  services like S3 via proxy mode could return corrupted files at around
@@ -144,12 +190,15 @@
144
190
 
145
191
  *Felipe Raul*
146
192
 
147
- ## Rails 7.0.3.1 (July 12, 2022) ##
193
+ * Saving attachment(s) to a record returns the blob/blobs object
148
194
 
149
- * No changes.
195
+ Previously, saving attachments did not return the blob/blobs that
196
+ were attached. Now, saving attachments to a record with `#attach`
197
+ method returns the blob or array of blobs that were attached to
198
+ the record. If it fails to save the attachment(s), then it returns
199
+ `false`.
150
200
 
151
-
152
- ## Rails 7.0.3 (May 09, 2022) ##
201
+ *Ghouse Mohamed*
153
202
 
154
203
  * Don't stream responses in redirect mode
155
204
 
@@ -161,319 +210,12 @@
161
210
 
162
211
  *Luke Lau*
163
212
 
164
- ## Rails 7.0.2.4 (April 26, 2022) ##
165
-
166
- * No changes.
167
-
168
-
169
- ## Rails 7.0.2.3 (March 08, 2022) ##
170
-
171
- * Added image transformation validation via configurable allow-list.
172
-
173
- Variant now offers a configurable allow-list for
174
- transformation methods in addition to a configurable deny-list for arguments.
175
-
176
- [CVE-2022-21831]
177
-
178
-
179
- ## Rails 7.0.2.2 (February 11, 2022) ##
180
-
181
- * No changes.
182
-
183
- ## Rails 7.0.2.1 (February 11, 2022) ##
184
-
185
- * No changes.
186
-
187
-
188
- ## Rails 7.0.2 (February 08, 2022) ##
189
-
190
- * Revert the ability to pass `service_name` param to `DirectUploadsController` which was introduced
191
- in 7.0.0.
192
-
193
- That change caused a lot of problems to upgrade Rails applications so we decided to remove it
194
- while in work in a more backwards compatible implementation.
195
-
196
- *Gannon McGibbon*
197
-
198
- * Allow applications to opt out of precompiling Active Storage JavaScript assets.
199
-
200
- *jlestavel*
201
-
202
-
203
- ## Rails 7.0.1 (January 06, 2022) ##
204
-
205
- * No changes.
206
-
207
-
208
- ## Rails 7.0.0 (December 15, 2021) ##
209
-
210
- * Support transforming empty-ish `has_many_attached` value into `[]` (e.g. `[""]`).
211
-
212
- ```ruby
213
- @user.highlights = [""]
214
- @user.highlights # => []
215
- ```
216
-
217
- *Sean Doyle*
218
-
219
-
220
- ## Rails 7.0.0.rc3 (December 14, 2021) ##
221
-
222
- * No changes.
223
-
224
-
225
- ## Rails 7.0.0.rc2 (December 14, 2021) ##
226
-
227
- * No changes.
228
-
229
- ## Rails 7.0.0.rc1 (December 06, 2021) ##
230
-
231
- * `Add ActiveStorage::Blob.compose` to concatenate multiple blobs.
232
-
233
- *Gannon McGibbon*
234
-
235
- * Setting custom metadata on blobs are now persisted to remote storage.
236
-
237
- *joshuamsager*
238
-
239
- * Support direct uploads to multiple services.
240
-
241
- *Dmitry Tsepelev*
242
-
243
- * Invalid default content types are deprecated
244
-
245
- Blobs created with content_type `image/jpg`, `image/pjpeg`, `image/bmp`, `text/javascript` will now produce
246
- a deprecation warning, since these are not valid content types.
247
-
248
- These content types will be removed from the defaults in Rails 7.1.
249
-
250
- You can set `config.active_storage.silence_invalid_content_types_warning = true` to dismiss the warning.
251
-
252
- *Alex Ghiculescu*
253
-
254
- ## Rails 7.0.0.alpha2 (September 15, 2021) ##
255
-
256
- * No changes.
257
-
258
-
259
- ## Rails 7.0.0.alpha1 (September 15, 2021) ##
260
-
261
- * Emit Active Support instrumentation events from Active Storage analyzers.
262
-
263
- Fixes #42930
264
-
265
- *Shouichi Kamiya*
266
-
267
- * Add support for byte range requests
268
-
269
- *Tom Prats*
270
-
271
- * Attachments can be deleted after their association is no longer defined.
272
-
273
- Fixes #42514
274
-
275
- *Don Sisco*
276
-
277
- * Make `vips` the default variant processor for new apps.
278
-
279
- See the upgrade guide for instructions on converting from `mini_magick` to `vips`. `mini_magick` is
280
- not deprecated, existing apps can keep using it.
281
-
282
- *Breno Gazzola*
283
-
284
- * Deprecate `ActiveStorage::Current.host` in favor of `ActiveStorage::Current.url_options` which accepts
285
- a host, protocol and port.
286
-
287
- *Santiago Bartesaghi*
288
-
289
- * Allow using [IAM](https://cloud.google.com/storage/docs/access-control/signed-urls) when signing URLs with GCS.
290
-
291
- ```yaml
292
- gcs:
293
- service: GCS
294
- ...
295
- iam: true
296
- ```
297
-
298
- *RRethy*
299
-
300
- * OpenSSL constants are now used for Digest computations.
301
-
302
- *Dirkjan Bussink*
303
-
304
- * Deprecate `config.active_storage.replace_on_assign_to_many`. Future versions of Rails
305
- will behave the same way as when the config is set to `true`.
306
-
307
- *Santiago Bartesaghi*
308
-
309
- * Remove deprecated methods: `build_after_upload`, `create_after_upload!` in favor of `create_and_upload!`,
310
- and `service_url` in favor of `url`.
311
-
312
- *Santiago Bartesaghi*
313
-
314
- * Add support of `strict_loading_by_default` to `ActiveStorage::Representations` controllers.
315
-
316
- *Anton Topchii*, *Andrew White*
317
-
318
- * Allow to detach an attachment when record is not persisted.
319
-
320
- *Jacopo Beschi*
321
-
322
- * Use libvips instead of ImageMagick to analyze images when `active_storage.variant_processor = vips`.
323
-
324
- *Breno Gazzola*
325
-
326
- * Add metadata value for presence of video channel in video blobs.
327
-
328
- The `metadata` attribute of video blobs has a new boolean key named `video` that is set to
329
- `true` if the file has an video channel and `false` if it doesn't.
330
-
331
- *Breno Gazzola*
332
-
333
- * Deprecate usage of `purge` and `purge_later` from the association extension.
334
-
335
- *Jacopo Beschi*
336
-
337
- * Passing extra parameters in `ActiveStorage::Blob#url` to S3 Client.
338
-
339
- This allows calls of `ActiveStorage::Blob#url` to have more interaction with
340
- the S3 Presigner, enabling, amongst other options, custom S3 domain URL
341
- Generation.
342
-
343
- ```ruby
344
- blob = ActiveStorage::Blob.last
345
-
346
- blob.url # => https://<bucket-name>.s3.<region>.amazonaws.com/<key>
347
- blob.url(virtual_host: true) # => # => https://<bucket-name>/<key>
348
- ```
349
-
350
- *josegomezr*
351
-
352
- * Allow setting a `Cache-Control` on files uploaded to GCS.
353
-
354
- ```yaml
355
- gcs:
356
- service: GCS
357
- ...
358
- cache_control: "public, max-age=3600"
359
- ```
360
-
361
- *maleblond*
362
-
363
- * The parameters sent to `ffmpeg` for generating a video preview image are now
364
- configurable under `config.active_storage.video_preview_arguments`.
365
-
366
- *Brendon Muir*
367
-
368
- * The ActiveStorage video previewer will now use scene change detection to generate
369
- better preview images (rather than the previous default of using the first frame
370
- of the video). This change requires FFmpeg v3.4+.
371
-
372
- *Jonathan Hefner*
373
-
374
- * Add support for ActiveStorage expiring URLs.
375
-
376
- ```ruby
377
- rails_blob_path(user.avatar, disposition: "attachment", expires_in: 30.minutes)
378
-
379
- <%= image_tag rails_blob_path(user.avatar.variant(resize: "100x100"), expires_in: 30.minutes) %>
380
- ```
381
-
382
- If you want to set default expiration time for ActiveStorage URLs throughout your application, set `config.active_storage.urls_expire_in`.
383
-
384
- *aki77*
385
-
386
- * Allow to purge an attachment when record is not persisted for `has_many_attached`.
387
-
388
- *Jacopo Beschi*
389
-
390
- * Add `with_all_variant_records` method to eager load all variant records on an attachment at once.
391
- `with_attached_image` scope now eager loads variant records if using variant tracking.
392
-
393
- *Alex Ghiculescu*
394
-
395
- * Add metadata value for presence of audio channel in video blobs.
396
-
397
- The `metadata` attribute of video blobs has a new boolean key named `audio` that is set to
398
- `true` if the file has an audio channel and `false` if it doesn't.
399
-
400
- *Breno Gazzola*
401
-
402
- * Adds analyzer for audio files.
403
-
404
- *Breno Gazzola*
405
-
406
- * Respect Active Record's primary_key_type in Active Storage migrations.
407
-
408
- *fatkodima*
409
-
410
- * Allow `expires_in` for ActiveStorage signed ids.
411
-
412
- *aki77*
413
-
414
- * Allow to purge an attachment when record is not persisted for `has_one_attached`.
415
-
416
- *Jacopo Beschi*
417
-
418
- * Add a load hook called `active_storage_variant_record` (providing `ActiveStorage::VariantRecord`)
419
- to allow for overriding aspects of the `ActiveStorage::VariantRecord` class. This makes
420
- `ActiveStorage::VariantRecord` consistent with `ActiveStorage::Blob` and `ActiveStorage::Attachment`
421
- that already have load hooks.
422
-
423
- *Brendon Muir*
424
-
425
- * `ActiveStorage::PreviewError` is raised when a previewer is unable to generate a preview image.
426
-
427
- *Alex Robbin*
428
-
429
- * Add `ActiveStorage::Streaming` module that can be included in a controller to get access to `#send_blob_stream`,
430
- which wraps the new `ActionController::Base#send_stream` method to stream a blob from cloud storage:
431
-
432
- ```ruby
433
- class MyPublicBlobsController < ApplicationController
434
- include ActiveStorage::SetBlob, ActiveStorage::Streaming
435
-
436
- def show
437
- http_cache_forever(public: true) do
438
- send_blob_stream @blob, disposition: params[:disposition]
439
- end
440
- end
441
- end
442
- ```
443
-
444
- *DHH*
445
-
446
- * Add ability to use pre-defined variants.
447
-
448
- ```ruby
449
- class User < ActiveRecord::Base
450
- has_one_attached :avatar do |attachable|
451
- attachable.variant :thumb, resize: "100x100"
452
- attachable.variant :medium, resize: "300x300", monochrome: true
453
- end
454
- end
455
-
456
- class Gallery < ActiveRecord::Base
457
- has_many_attached :photos do |attachable|
458
- attachable.variant :thumb, resize: "100x100"
459
- attachable.variant :medium, resize: "300x300", monochrome: true
460
- end
461
- end
462
-
463
- <%= image_tag user.avatar.variant(:thumb) %>
464
- ```
465
-
466
- *fatkodima*
467
-
468
- * After setting `config.active_storage.resolve_model_to_route = :rails_storage_proxy`
469
- `rails_blob_path` and `rails_representation_path` will generate proxy URLs by default.
470
-
471
- *Ali Ismayilov*
472
-
473
- * Declare `ActiveStorage::FixtureSet` and `ActiveStorage::FixtureSet.blob` to
474
- improve fixture integration.
213
+ * Safe for direct upload on Libraries or Frameworks
475
214
 
476
- *Sean Doyle*
215
+ Enable the use of custom headers during direct uploads, which allows for
216
+ the inclusion of Authorization bearer tokens or other forms of authorization
217
+ tokens through headers.
477
218
 
219
+ *Radamés Roriz*
478
220
 
479
- Please check [6-1-stable](https://github.com/rails/rails/blob/6-1-stable/activestorage/CHANGELOG.md) for previous changes.
221
+ Please check [7-0-stable](https://github.com/rails/rails/blob/7-0-stable/activestorage/CHANGELOG.md) for previous changes.
data/MIT-LICENSE CHANGED
@@ -1,4 +1,4 @@
1
- Copyright (c) 2017-2022 David Heinemeier Hansson, Basecamp
1
+ Copyright (c) David Heinemeier Hansson, 37signals LLC
2
2
 
3
3
  Permission is hereby granted, free of charge, to any person obtaining
4
4
  a copy of this software and associated documentation files (the
data/README.md CHANGED
@@ -6,11 +6,11 @@ Files can be uploaded from the server to the cloud or directly from the client t
6
6
 
7
7
  Image files can furthermore be transformed using on-demand variants for quality, aspect ratio, size, or any other [MiniMagick](https://github.com/minimagick/minimagick) or [Vips](https://www.rubydoc.info/gems/ruby-vips/Vips/Image) supported transformation.
8
8
 
9
- You can read more about Active Storage in the [Active Storage Overview](https://edgeguides.rubyonrails.org/active_storage_overview.html) guide.
9
+ You can read more about Active Storage in the [Active Storage Overview](https://guides.rubyonrails.org/active_storage_overview.html) guide.
10
10
 
11
11
  ## Compared to other storage solutions
12
12
 
13
- A key difference to how Active Storage works compared to other attachment solutions in Rails is through the use of built-in [Blob](https://github.com/rails/rails/blob/main/activestorage/app/models/active_storage/blob.rb) and [Attachment](https://github.com/rails/rails/blob/main/activestorage/app/models/active_storage/attachment.rb) models (backed by Active Record). This means existing application models do not need to be modified with additional columns to associate with files. Active Storage uses polymorphic associations via the `Attachment` join model, which then connects to the actual `Blob`.
13
+ A key difference to how Active Storage works compared to other attachment solutions in \Rails is through the use of built-in [Blob](https://github.com/rails/rails/blob/main/activestorage/app/models/active_storage/blob.rb) and [Attachment](https://github.com/rails/rails/blob/main/activestorage/app/models/active_storage/attachment.rb) models (backed by Active Record). This means existing application models do not need to be modified with additional columns to associate with files. Active Storage uses polymorphic associations via the `Attachment` join model, which then connects to the actual `Blob`.
14
14
 
15
15
  `Blob` models store attachment metadata (filename, content-type, etc.), and their identifier key in the storage service. Blob models do not store the actual binary data. They are intended to be immutable in spirit. One file, one blob. You can associate the same blob with multiple application models as well. And if you want to do transformations of a given `Blob`, the idea is that you'll simply create a new one, rather than attempt to mutate the existing one (though of course you can delete the previous version later if you don't need it).
16
16
 
@@ -144,11 +144,11 @@ Active Storage, with its included JavaScript library, supports uploading directl
144
144
 
145
145
  1. Include the Active Storage JavaScript in your application's JavaScript bundle or reference it directly.
146
146
 
147
- Requiring directly without bundling through the asset pipeline in the application html with autostart:
148
- ```erb
147
+ Requiring directly without bundling through the asset pipeline in the application HTML with autostart:
148
+ ```html
149
149
  <%= javascript_include_tag "activestorage" %>
150
150
  ```
151
- Requiring via importmap-rails without bundling through the asset pipeline in the application html without autostart as ESM:
151
+ Requiring via importmap-rails without bundling through the asset pipeline in the application HTML without autostart as ESM:
152
152
  ```ruby
153
153
  # config/importmap.rb
154
154
  pin "@rails/activestorage", to: "activestorage.esm.js"