-
Notifications
You must be signed in to change notification settings - Fork 21.9k
Description
Steps to reproduce
Background
I'm using Active Storage with Disk storage. I want users to upload a json file attached to a model called Test_Model
. The model has an attribute name
that I'd like to populate with data from the JSON file.
When I call JSON.parse(self.jsonfile.download)
to retrieve the name
from the json file, I get an ActiveStorage::FileNotFoundError
error.
Steps
- Clone the Example Repo
- bundle && rails db:migrate
- Visit http://localhost:3000/test_models/new
- Upload any file, leave Name blank
Expected behavior
I expect to be able to manipulate the as-yet-unsaved version of of this file before I save the record to the database.
Actual behavior
I get an ActiveStorage::FileNotFoundError
error with the following exception cause: Errno::ENOENT: No such file or directory @ rb_sysopen - /Users/franktisellano/Desktop/activestorage-example/storage/i6/7e/i67ej7r9nx1yz838eor5v1hwpa3o
.
System configuration
Rails version: 6.0.0
Ruby version: 2.5.0
Operating System: Mac 10.13.6 High Sierra