Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

How to configure the endpoint prop #55

Open
emersonthis opened this issue Jul 3, 2020 · 1 comment
Open

How to configure the endpoint prop #55

emersonthis opened this issue Jul 3, 2020 · 1 comment

Comments

@emersonthis
Copy link

Thanks for this great tool!

I don't understand how to configure the required endpoint prop. I suspect this references a pre-existing configuration or value related to active_storage, but I can't find it anywhere in the documentation. Can you say a few words about how to determine the values of that object? Thanks in advance.

@emersonthis
Copy link
Author

I found the answer in your tutorial. It clicked when I saw the comment in this snippet:

<ActiveStorageProvider
  // -- How to attach the uploaded blob to your model
  endpoint={{
    path: '/profile',
    model: 'User',
    attribute: 'avatar',
    method: 'PUT',
  }}

In case it wasn't clear to anyone else, the component is handling the direct upload to store the file. That endpoint can be thought of as a callback that associates that uploaded file with the record. In this way, it's a two-part process:

  1. uploading/storing the file
  2. associating it with record

Maybe this was obvious to others who are more familiar with active storage direct uploads, but it took me some time to figure out so perhaps this will save others some time.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant