Skip to content

Commit

Permalink
Merge pull request #51893 from indigotechtutorials/main
Browse files Browse the repository at this point in the history
Fix the Direct Upload class example in Active Storage Docs [ci skip]
  • Loading branch information
carlosantoniodasilva committed May 23, 2024
2 parents b284f8b + 3855416 commit be2ecdf
Showing 1 changed file with 4 additions and 4 deletions.
8 changes: 4 additions & 4 deletions guides/source/active_storage_overview.md
Original file line number Diff line number Diff line change
Expand Up @@ -1302,10 +1302,10 @@ import { DirectUpload } from "@rails/activestorage"

class Uploader {
constructor(file, url) {
this.upload = new DirectUpload(this.file, this.url, this)
this.upload = new DirectUpload(file, url, this)
}

upload(file) {
uploadFile(file) {
this.upload.create((error, blob) => {
if (error) {
// Handle the error
Expand Down Expand Up @@ -1342,10 +1342,10 @@ class Uploader {
const headers = { 'Authentication': `Bearer ${token}` }
// INFO: Sending headers is an optional parameter. If you choose not to send headers,
// authentication will be performed using cookies or session data.
this.upload = new DirectUpload(this.file, this.url, this, headers)
this.upload = new DirectUpload(file, url, this, headers)
}

upload(file) {
uploadFile(file) {
this.upload.create((error, blob) => {
if (error) {
// Handle the error
Expand Down

0 comments on commit be2ecdf

Please sign in to comment.