activestorage 6.0.3.1 → 6.1.0.rc2
Sign up to get free protection for your applications and to get access to all the features.
Potentially problematic release.
This version of activestorage might be problematic. Click here for more details.
- checksums.yaml +4 -4
- data/CHANGELOG.md +148 -145
- data/MIT-LICENSE +1 -1
- data/README.md +35 -3
- data/app/controllers/active_storage/base_controller.rb +11 -0
- data/app/controllers/active_storage/blobs/proxy_controller.rb +14 -0
- data/app/controllers/active_storage/{blobs_controller.rb → blobs/redirect_controller.rb} +2 -2
- data/app/controllers/active_storage/direct_uploads_controller.rb +1 -1
- data/app/controllers/active_storage/disk_controller.rb +8 -20
- data/app/controllers/active_storage/representations/proxy_controller.rb +19 -0
- data/app/controllers/active_storage/{representations_controller.rb → representations/redirect_controller.rb} +2 -2
- data/app/controllers/concerns/active_storage/file_server.rb +18 -0
- data/app/controllers/concerns/active_storage/set_blob.rb +1 -1
- data/app/controllers/concerns/active_storage/set_current.rb +2 -2
- data/app/controllers/concerns/active_storage/set_headers.rb +12 -0
- data/app/jobs/active_storage/mirror_job.rb +15 -0
- data/app/models/active_storage/attachment.rb +18 -10
- data/app/models/active_storage/blob.rb +114 -59
- data/app/models/active_storage/blob/analyzable.rb +6 -2
- data/app/models/active_storage/blob/identifiable.rb +7 -6
- data/app/models/active_storage/blob/representable.rb +34 -4
- data/app/models/active_storage/preview.rb +31 -10
- data/app/models/active_storage/record.rb +7 -0
- data/app/models/active_storage/variant.rb +28 -41
- data/app/models/active_storage/variant_record.rb +8 -0
- data/app/models/active_storage/variant_with_record.rb +54 -0
- data/app/models/active_storage/variation.rb +25 -20
- data/config/routes.rb +58 -8
- data/db/migrate/20170806125915_create_active_storage_tables.rb +14 -5
- data/db/update_migrate/20190112182829_add_service_name_to_active_storage_blobs.rb +17 -0
- data/db/update_migrate/20191206030411_create_active_storage_variant_records.rb +11 -0
- data/lib/active_storage.rb +5 -2
- data/lib/active_storage/analyzer.rb +6 -0
- data/lib/active_storage/analyzer/image_analyzer.rb +3 -0
- data/lib/active_storage/analyzer/null_analyzer.rb +4 -0
- data/lib/active_storage/analyzer/video_analyzer.rb +14 -3
- data/lib/active_storage/attached/changes/create_many.rb +1 -0
- data/lib/active_storage/attached/changes/create_one.rb +17 -4
- data/lib/active_storage/attached/many.rb +4 -3
- data/lib/active_storage/attached/model.rb +77 -16
- data/lib/active_storage/attached/one.rb +4 -3
- data/lib/active_storage/engine.rb +25 -27
- data/lib/active_storage/gem_version.rb +3 -3
- data/lib/active_storage/log_subscriber.rb +6 -0
- data/lib/active_storage/previewer.rb +3 -2
- data/lib/active_storage/previewer/mupdf_previewer.rb +3 -3
- data/lib/active_storage/previewer/poppler_pdf_previewer.rb +3 -3
- data/lib/active_storage/previewer/video_previewer.rb +2 -2
- data/lib/active_storage/service.rb +36 -7
- data/lib/active_storage/service/azure_storage_service.rb +40 -35
- data/lib/active_storage/service/configurator.rb +3 -1
- data/lib/active_storage/service/disk_service.rb +36 -31
- data/lib/active_storage/service/gcs_service.rb +18 -16
- data/lib/active_storage/service/mirror_service.rb +31 -7
- data/lib/active_storage/service/registry.rb +32 -0
- data/lib/active_storage/service/s3_service.rb +53 -23
- data/lib/active_storage/transformers/image_processing_transformer.rb +13 -7
- data/lib/active_storage/transformers/transformer.rb +0 -3
- metadata +55 -19
- data/db/update_migrate/20180723000244_add_foreign_key_constraint_to_active_storage_attachments_for_blob_id.rb +0 -9
- data/lib/active_storage/downloading.rb +0 -47
- data/lib/active_storage/transformers/mini_magick_transformer.rb +0 -38
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: '0899559a3bc6de6d857ebb86597fab1354a02ae06697d643f689dcd763c688c1'
|
4
|
+
data.tar.gz: edbc9a4f7a25b9bd92f6bec1dca219b49df78c26fb774e0c4097dd59430f95f1
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 257274e3e39b3af4dbab977180cc0357644171832a319d213fadefb24958b282a122001bb97890b2fffd8ec5124c03ca00e4fafd20f00bc33a2268595109db75
|
7
|
+
data.tar.gz: c4a122be03c4f7b513dc5d3dc5f229bbaef056af48e250133cfd250be2481ea22c864dded8f0668ef0da6a97e99c8061c837e21fafb0127840095d5bd7dfdd49
|
data/CHANGELOG.md
CHANGED
@@ -1,235 +1,238 @@
|
|
1
|
-
## Rails 6.0.
|
1
|
+
## Rails 6.1.0.rc2 (December 01, 2020) ##
|
2
2
|
|
3
|
-
*
|
3
|
+
* Implement `strict_loading` on ActiveStorage associations.
|
4
4
|
|
5
|
-
|
5
|
+
*David Angulo*
|
6
6
|
|
7
|
-
|
7
|
+
## Rails 6.1.0.rc1 (November 02, 2020) ##
|
8
8
|
|
9
|
+
* Remove deprecated support to pass `:combine_options` operations to `ActiveStorage::Transformers::ImageProcessing`.
|
9
10
|
|
10
|
-
|
11
|
+
*Rafael Mendonça França*
|
11
12
|
|
12
|
-
*
|
13
|
+
* Remove deprecated `ActiveStorage::Transformers::MiniMagickTransformer`.
|
13
14
|
|
15
|
+
*Rafael Mendonça França*
|
14
16
|
|
15
|
-
|
17
|
+
* Remove deprecated `config.active_storage.queue`.
|
16
18
|
|
17
|
-
*
|
19
|
+
*Rafael Mendonça França*
|
18
20
|
|
21
|
+
* Remove deprecated `ActiveStorage::Downloading`.
|
19
22
|
|
20
|
-
|
23
|
+
*Rafael Mendonça França*
|
21
24
|
|
22
|
-
*
|
25
|
+
* Add per-environment configuration support
|
23
26
|
|
27
|
+
*Pietro Moro*
|
24
28
|
|
25
|
-
|
29
|
+
* The Poppler PDF previewer renders a preview image using the original
|
30
|
+
document's crop box rather than its media box, hiding print margins. This
|
31
|
+
matches the behavior of the MuPDF previewer.
|
26
32
|
|
27
|
-
*
|
33
|
+
*Vincent Robert*
|
28
34
|
|
29
|
-
|
30
|
-
|
31
|
-
* Blobs are recorded in the database before being uploaded to the service.
|
32
|
-
This fixes that generated blob keys could silently collide, leading to
|
33
|
-
data loss.
|
34
|
-
|
35
|
-
*Julik Tarkhanov*
|
35
|
+
* Touch parent model when an attachment is purged.
|
36
36
|
|
37
|
+
*Víctor Pérez Rodríguez*
|
37
38
|
|
38
|
-
|
39
|
+
* Files can now be served by proxying them from the underlying storage service
|
40
|
+
instead of redirecting to a signed service URL. Use the
|
41
|
+
`rails_storage_proxy_path` and `_url` helpers to proxy an attached file:
|
39
42
|
|
40
|
-
|
41
|
-
|
42
|
-
|
43
|
-
## Rails 6.0.0.rc2 (July 22, 2019) ##
|
44
|
-
|
45
|
-
* No changes.
|
43
|
+
```erb
|
44
|
+
<%= image_tag rails_storage_proxy_path(@user.avatar) %>
|
45
|
+
```
|
46
46
|
|
47
|
+
To proxy by default, set `config.active_storage.resolve_model_to_route`:
|
47
48
|
|
48
|
-
|
49
|
+
```ruby
|
50
|
+
# Proxy attached files instead.
|
51
|
+
config.active_storage.resolve_model_to_route = :rails_storage_proxy
|
52
|
+
```
|
49
53
|
|
50
|
-
|
54
|
+
```erb
|
55
|
+
<%= image_tag @user.avatar %>
|
56
|
+
```
|
51
57
|
|
52
|
-
|
58
|
+
To redirect to a signed service URL when the default file serving strategy
|
59
|
+
is set to proxying, use the `rails_storage_redirect_path` and `_url` helpers:
|
53
60
|
|
54
|
-
|
61
|
+
```erb
|
62
|
+
<%= image_tag rails_storage_redirect_path(@user.avatar) %>
|
63
|
+
```
|
55
64
|
|
56
|
-
*
|
65
|
+
*Jonathan Fleckenstein*
|
57
66
|
|
58
|
-
|
67
|
+
* Add `config.active_storage.web_image_content_types` to allow applications
|
68
|
+
to add content types (like `image/webp`) in which variants can be processed,
|
69
|
+
instead of letting those images be converted to the fallback PNG format.
|
59
70
|
|
71
|
+
*Jeroen van Haperen*
|
60
72
|
|
61
|
-
|
73
|
+
* Add support for creating variants of `WebP` images out of the box.
|
62
74
|
|
63
|
-
*
|
75
|
+
*Dino Maric*
|
64
76
|
|
77
|
+
* Only enqueue analysis jobs for blobs with non-null analyzer classes.
|
65
78
|
|
66
|
-
|
79
|
+
*Gannon McGibbon*
|
67
80
|
|
68
|
-
*
|
81
|
+
* Previews are created on the same service as the original blob.
|
69
82
|
|
83
|
+
*Peter Zhu*
|
70
84
|
|
71
|
-
|
85
|
+
* Remove unused `disposition` and `content_type` query parameters for `DiskService`.
|
72
86
|
|
73
|
-
*
|
74
|
-
[`activestorage`](https://www.npmjs.com/package/activestorage) to
|
75
|
-
[`@rails/activestorage`](https://www.npmjs.com/package/@rails/activestorage).
|
87
|
+
*Peter Zhu*
|
76
88
|
|
77
|
-
|
89
|
+
* Use `DiskController` for both public and private files.
|
78
90
|
|
79
|
-
|
80
|
-
|
91
|
+
`DiskController` is able to handle multiple services by adding a
|
92
|
+
`service_name` field in the generated URL in `DiskService`.
|
81
93
|
|
82
|
-
*
|
83
|
-
* `config.active_storage.queues.purge`
|
94
|
+
*Peter Zhu*
|
84
95
|
|
85
|
-
|
86
|
-
set, but it is deprecated and will be removed in Rails 6.1.
|
96
|
+
* Variants are tracked in the database to avoid existence checks in the storage service.
|
87
97
|
|
88
98
|
*George Claghorn*
|
89
99
|
|
90
|
-
*
|
100
|
+
* Deprecate `service_url` methods in favour of `url`.
|
91
101
|
|
92
|
-
|
102
|
+
Deprecate `Variant#service_url` and `Preview#service_url` to instead use
|
103
|
+
`#url` method to be consistent with `Blob`.
|
93
104
|
|
94
|
-
*
|
95
|
-
collisions and undefined behavior with case-insensitive filesystems and
|
96
|
-
database indices.
|
105
|
+
*Peter Zhu*
|
97
106
|
|
98
|
-
|
99
|
-
|
100
|
-
* It doesn’t include an `X-CSRF-Token` header if a meta tag is not found on
|
101
|
-
the page. It previously included one with a value of `undefined`.
|
107
|
+
* Permanent URLs for public storage blobs.
|
102
108
|
|
103
|
-
|
109
|
+
Services can be configured in `config/storage.yml` with a new key
|
110
|
+
`public: true | false` to indicate whether a service holds public
|
111
|
+
blobs or private blobs. Public services will always return a permanent URL.
|
104
112
|
|
105
|
-
|
113
|
+
Deprecates `Blob#service_url` in favor of `Blob#url`.
|
106
114
|
|
107
|
-
*
|
115
|
+
*Peter Zhu*
|
108
116
|
|
109
|
-
*
|
117
|
+
* Make services aware of configuration names.
|
110
118
|
|
111
|
-
*
|
119
|
+
*Gannon McGibbon*
|
112
120
|
|
113
|
-
*
|
121
|
+
* The `Content-Type` header is set on image variants when they're uploaded to third-party storage services.
|
114
122
|
|
115
|
-
*
|
123
|
+
*Kyle Ribordy*
|
116
124
|
|
117
|
-
*
|
118
|
-
relevant types of `Azure::Core::Http::HTTPError`. It previously obscured
|
119
|
-
other types of `HTTPError`, which is the azure-storage gem’s catch-all
|
120
|
-
exception class.
|
125
|
+
* Allow storage services to be configured per attachment.
|
121
126
|
|
122
|
-
|
127
|
+
```ruby
|
128
|
+
class User < ActiveRecord::Base
|
129
|
+
has_one_attached :avatar, service: :s3
|
130
|
+
end
|
123
131
|
|
124
|
-
|
125
|
-
|
126
|
-
|
132
|
+
class Gallery < ActiveRecord::Base
|
133
|
+
has_many_attached :photos, service: :s3
|
134
|
+
end
|
135
|
+
```
|
127
136
|
|
128
|
-
*
|
137
|
+
*Dmitry Tsepelev*
|
129
138
|
|
130
|
-
*
|
131
|
-
`ActiveStorage::FileNotFoundError` when the corresponding file is missing
|
132
|
-
from the storage service. Services translate service-specific missing object
|
133
|
-
exceptions (e.g. `Google::Cloud::NotFoundError` for the GCS service and
|
134
|
-
`Errno::ENOENT` for the disk service) into
|
135
|
-
`ActiveStorage::FileNotFoundError`.
|
139
|
+
* You can optionally provide a custom blob key when attaching a new file:
|
136
140
|
|
137
|
-
|
141
|
+
```ruby
|
142
|
+
user.avatar.attach key: "avatars/#{user.id}.jpg",
|
143
|
+
io: io, content_type: "image/jpeg", filename: "avatar.jpg"
|
144
|
+
```
|
138
145
|
|
139
|
-
|
140
|
-
controllers that can't inherit from `ActiveStorage::BaseController`.
|
146
|
+
Active Storage will store the blob's data on the configured service at the provided key.
|
141
147
|
|
142
148
|
*George Claghorn*
|
143
149
|
|
144
|
-
*
|
145
|
-
`ActiveStorage::UnrepresentableError` now inherit from `ActiveStorage::Error`
|
146
|
-
instead of `StandardError`. This permits rescuing `ActiveStorage::Error` to
|
147
|
-
handle all Active Storage errors.
|
150
|
+
* Replace `Blob.create_after_upload!` with `Blob.create_and_upload!` and deprecate the former.
|
148
151
|
|
149
|
-
|
152
|
+
`create_after_upload!` has been removed since it could lead to data
|
153
|
+
corruption by uploading to a key on the storage service which happened to
|
154
|
+
be already taken. Creating the record would then correctly raise a
|
155
|
+
database uniqueness exception but the stored object would already have
|
156
|
+
overwritten another. `create_and_upload!` swaps the order of operations
|
157
|
+
so that the key gets reserved up-front or the uniqueness error gets raised,
|
158
|
+
before the upload to a key takes place.
|
150
159
|
|
151
|
-
*
|
152
|
-
is saved instead of immediately.
|
160
|
+
*Julik Tarkhanov*
|
153
161
|
|
154
|
-
|
155
|
-
be stored:
|
162
|
+
* Set content disposition in direct upload using `filename` and `disposition` parameters to `ActiveStorage::Service#headers_for_direct_upload`.
|
156
163
|
|
157
|
-
|
158
|
-
@user.avatar = params[:avatar]
|
159
|
-
```
|
164
|
+
*Peter Zhu*
|
160
165
|
|
161
|
-
|
166
|
+
* Allow record to be optionally passed to blob finders to make sharding
|
167
|
+
easier.
|
162
168
|
|
163
|
-
*
|
169
|
+
*Gannon McGibbon*
|
164
170
|
|
165
|
-
*
|
166
|
-
ActiveRecord reflection mechanism.
|
171
|
+
* Switch from `azure-storage` gem to `azure-storage-blob` gem for Azure service.
|
167
172
|
|
168
|
-
*
|
173
|
+
*Peter Zhu*
|
169
174
|
|
170
|
-
*
|
171
|
-
processor. For example, the following will not have the monochrome
|
172
|
-
variation applied:
|
175
|
+
* Add `config.active_storage.draw_routes` to disable Active Storage routes.
|
173
176
|
|
174
|
-
|
175
|
-
avatar.variant(monochrome: false)
|
176
|
-
```
|
177
|
+
*Gannon McGibbon*
|
177
178
|
|
178
|
-
|
179
|
+
* Image analysis is skipped if ImageMagick returns an error.
|
179
180
|
|
180
|
-
|
181
|
-
|
182
|
-
|
181
|
+
`ActiveStorage::Analyzer::ImageAnalyzer#metadata` would previously raise a
|
182
|
+
`MiniMagick::Error`, which caused persistent `ActiveStorage::AnalyzeJob`
|
183
|
+
failures. It now logs the error and returns `{}`, resulting in no metadata
|
184
|
+
being added to the offending image blob.
|
183
185
|
|
184
|
-
*
|
185
|
-
|
186
|
-
* Add `ActiveStorage::Blob#open`, which downloads a blob to a tempfile on disk
|
187
|
-
and yields the tempfile. Deprecate `ActiveStorage::Downloading`.
|
186
|
+
*George Claghorn*
|
188
187
|
|
189
|
-
|
188
|
+
* Method calls on singular attachments return `nil` when no file is attached.
|
190
189
|
|
191
|
-
|
192
|
-
`
|
193
|
-
type inference. For example:
|
190
|
+
Previously, assuming the following User model, `user.avatar.filename` would
|
191
|
+
raise a `Module::DelegationError` if no avatar was attached:
|
194
192
|
|
195
193
|
```ruby
|
196
|
-
|
197
|
-
|
198
|
-
|
199
|
-
content_type: 'application/pdf',
|
200
|
-
identify: false
|
201
|
-
)
|
194
|
+
class User < ApplicationRecord
|
195
|
+
has_one_attached :avatar
|
196
|
+
end
|
202
197
|
```
|
203
198
|
|
204
|
-
|
199
|
+
They now return `nil`.
|
205
200
|
|
206
|
-
*
|
207
|
-
It now requires version 1.11 or newer of the google-cloud-storage gem.
|
208
|
-
|
209
|
-
*George Claghorn*
|
201
|
+
*Matthew Tanous*
|
210
202
|
|
211
|
-
*
|
212
|
-
for Active Storage variants, and deprecate the MiniMagick backend.
|
203
|
+
* The mirror service supports direct uploads.
|
213
204
|
|
214
|
-
|
215
|
-
|
216
|
-
|
217
|
-
other ImageProcessing macros. These are now recommended over raw `:resize`,
|
218
|
-
as they also sharpen the thumbnail after resizing.
|
205
|
+
New files are directly uploaded to the primary service. When a
|
206
|
+
directly-uploaded file is attached to a record, a background job is enqueued
|
207
|
+
to copy it to each secondary service.
|
219
208
|
|
220
|
-
|
221
|
-
|
222
|
-
ImageMagick which has significantly better performance than
|
223
|
-
ImageMagick in most cases, both in terms of speed and memory usage. In
|
224
|
-
Active Storage it's now possible to switch to the libvips backend by
|
225
|
-
changing `Rails.application.config.active_storage.variant_processor` to
|
226
|
-
`:vips`.
|
209
|
+
Configure the queue used to process mirroring jobs by setting
|
210
|
+
`config.active_storage.queues.mirror`. The default is `:active_storage_mirror`.
|
227
211
|
|
228
|
-
*
|
212
|
+
*George Claghorn*
|
229
213
|
|
230
|
-
*
|
214
|
+
* The S3 service now permits uploading files larger than 5 gigabytes.
|
215
|
+
|
216
|
+
When uploading a file greater than 100 megabytes in size, the service
|
217
|
+
transparently switches to [multipart uploads](https://docs.aws.amazon.com/AmazonS3/latest/dev/mpuoverview.html)
|
218
|
+
using a part size computed from the file's total size and S3's part count limit.
|
219
|
+
|
220
|
+
No application changes are necessary to take advantage of this feature. You
|
221
|
+
can customize the default 100 MB multipart upload threshold in your S3
|
222
|
+
service's configuration:
|
223
|
+
|
224
|
+
```yaml
|
225
|
+
production:
|
226
|
+
service: s3
|
227
|
+
access_key_id: <%= Rails.application.credentials.dig(:aws, :access_key_id) %>
|
228
|
+
secret_access_key: <%= Rails.application.credentials.dig(:aws, :secret_access_key) %>
|
229
|
+
region: us-east-1
|
230
|
+
bucket: my-bucket
|
231
|
+
upload:
|
232
|
+
multipart_threshold: <%= 250.megabytes %>
|
233
|
+
```
|
231
234
|
|
232
|
-
*
|
235
|
+
*George Claghorn*
|
233
236
|
|
234
237
|
|
235
|
-
Please check [
|
238
|
+
Please check [6-0-stable](https://github.com/rails/rails/blob/6-0-stable/activestorage/CHANGELOG.md) for previous changes.
|
data/MIT-LICENSE
CHANGED
data/README.md
CHANGED
@@ -16,7 +16,7 @@ A key difference to how Active Storage works compared to other attachment soluti
|
|
16
16
|
|
17
17
|
## Installation
|
18
18
|
|
19
|
-
Run `rails active_storage:install` to copy over active_storage migrations.
|
19
|
+
Run `bin/rails active_storage:install` to copy over active_storage migrations.
|
20
20
|
|
21
21
|
NOTE: If the task cannot be found, verify that `require "active_storage/engine"` is present in `config/application.rb`.
|
22
22
|
|
@@ -55,7 +55,7 @@ url_for(user.avatar)
|
|
55
55
|
|
56
56
|
class AvatarsController < ApplicationController
|
57
57
|
def update
|
58
|
-
# params[:avatar] contains
|
58
|
+
# params[:avatar] contains an ActionDispatch::Http::UploadedFile object
|
59
59
|
Current.user.avatar.attach(params.require(:avatar))
|
60
60
|
redirect_to Current.user
|
61
61
|
end
|
@@ -106,6 +106,37 @@ Variation of image attachment:
|
|
106
106
|
<%= image_tag user.avatar.variant(resize_to_limit: [100, 100]) %>
|
107
107
|
```
|
108
108
|
|
109
|
+
## File serving strategies
|
110
|
+
|
111
|
+
Active Storage supports two ways to serve files: redirecting and proxying.
|
112
|
+
|
113
|
+
### Redirecting
|
114
|
+
|
115
|
+
Active Storage generates stable application URLs for files which, when accessed, redirect to signed, short-lived service URLs. This relieves application servers of the burden of serving file data. It is the default file serving strategy.
|
116
|
+
|
117
|
+
When the application is configured to proxy files by default, use the `rails_storage_redirect_path` and `_url` route helpers to redirect instead:
|
118
|
+
|
119
|
+
```erb
|
120
|
+
<%= image_tag rails_storage_redirect_path(@user.avatar) %>
|
121
|
+
```
|
122
|
+
|
123
|
+
### Proxying
|
124
|
+
|
125
|
+
Optionally, files can be proxied instead. This means that your application servers will download file data from the storage service in response to requests. This can be useful for serving files from a CDN.
|
126
|
+
|
127
|
+
Explicitly proxy attachments using the `rails_storage_proxy_path` and `_url` route helpers:
|
128
|
+
|
129
|
+
```erb
|
130
|
+
<%= image_tag rails_storage_proxy_path(@user.avatar) %>
|
131
|
+
```
|
132
|
+
|
133
|
+
Or configure Active Storage to use proxying by default:
|
134
|
+
|
135
|
+
```ruby
|
136
|
+
# config/initializers/active_storage.rb
|
137
|
+
Rails.application.config.active_storage.resolve_model_to_route = :rails_storage_proxy
|
138
|
+
```
|
139
|
+
|
109
140
|
## Direct uploads
|
110
141
|
|
111
142
|
Active Storage, with its included JavaScript library, supports uploading directly from the client to the cloud.
|
@@ -120,7 +151,8 @@ Active Storage, with its included JavaScript library, supports uploading directl
|
|
120
151
|
```
|
121
152
|
Using the npm package:
|
122
153
|
```js
|
123
|
-
|
154
|
+
import * as ActiveStorage from "@rails/activestorage"
|
155
|
+
ActiveStorage.start()
|
124
156
|
```
|
125
157
|
2. Annotate file inputs with the direct upload URL.
|
126
158
|
|