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
Active Storage Module::DelegationError: size delegated to attachment, but attachment is nil #35613
Comments
Can you provide an example application that reproduces the error? Also, to attach a raw file with ActiveStorage, you need to do something like this:
|
After tinkering with the partial file that leads to this issue. I was able to get past this error, momentarily. The next Issue I have, is Active Storage is not saving the image when the form is posted through AJAX. I can understand the delay between the form POST and the server waiting for Active Storage to retrieve an image. But, no image is saved at all. (I'm using the latest remotipart gem). The avatar loads problem free, which I seeded into the database. _form.html.erb
create.js.erb
The form submits, but forgets the photo was being uploaded. @gmcgibbon -- I don't know how to get past this error with Active Storage. Server Log
|
I just need simple ajax functionality for images to work. I see that you can do it with the JS Direct Upload events. But, how would I implement it into my current solution? |
For usage questions, please refer to the mailing list or StackOverflow where a wider community can assist you. This also seems like it might be a problem related to the |
I am also randomly facing this issue, some records save all fine some end up with this error. My files are also being posted by AJAX request. Something is going on, any help with debugging will be great. |
I think I found cause for our case, this issue can is occuring if your table PK type is not int/bigint, in our case that type is uuid, closer inspection seems to suggest that it kidn fo calls Which works for some UUIDs and does not for other. Even when it works that;s not reliable. There are issues like #35746 which can be of help. |
Steps to reproduce
post.rb
has_one_attached :photo
posts_controller.rb
rails console
Expected behavior
The post should save with the photo attached.
Actual behavior
The post is rolling back with a size delegated to attachment, but attachment is nil error.
System configuration
Rails version:
rails 5.2.0
Ruby version:
ruby 2.4.4
The text was updated successfully, but these errors were encountered: