-
Notifications
You must be signed in to change notification settings - Fork 632
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
"Undefined method purge_later
" error when attaching file to file fragment in Rails 6
#898
Comments
I'm not sure why this isn't working, the Rails 6 documentation shows that ActiveStorage::Attached::Many should have a |
It seems that the default action for Rails 6 is to replace existing attachments, instead of append, so the |
It appears that the aforementioned change in Rails 6's default action is for #update, #attach retains its append functionality. That said, Rails 6 did have a change to the implementation of ActiveStorage::Attached::Many#purge & #purge_later: rails/rails@f9a5839. |
@morgant I am unable to attach through the WYSIWYG as you mention above. I get an infinite loop when attaching a file: https://gist.github.com/nitsujri/7b0a815d1702f159860a9a679f70abb4 It appears to be trying to add and then immediately purge the blob? I'm not 100% sure/understand. I am running a similar setup: Ruby 2.6.4 Let me know if I can help. I have downgraded my Rails version (easy) since we cannot upload images to blog posts/pages. [Edit] I created a blank project example w/ steps showing what I'm seeing above. https://github.com/nitsujri/comfy-activestorage-example Thanks guys for this great gem! |
@nitsujri Thanks, upon further investigation, I'm getting an infinite loop if I comment out the |
@nitsujri It looks like this may be a bug in Rails 6.0 related to #attach and |
@nitsujri Changing the |
@morgant Ah yep, that worked! https://github.com/nitsujri/comfy-activestorage-example/tree/fixed The example has a fixed branch now working, and I tested it on our actual app which works great too. Love to see this merged in asap =) |
Note: For general questions and feature requests please leave a message
on Gitter: https://gitter.im/comfy/comfortable-mexican-sofa
Expected behavior
Upload file via page file fragment, pages#update should result in file being attached to fragment without error.
Actual behavior
Under Ruby 2.6.3 & Rails 6.0.0, during pages#update the following error is generated:
Steps to reproduce
Edit a page with a layout containing a file tag such as:
{{ cms:file slide_image, namespace: slide, render: false }}
Select an image file for the the file field (e.g. slide_image field)
Click "Update Page" button
This does not occur if the image is attached inline within a WYSIWYG content fragment.
System configuration
Rails version: 6.0.0
CMS version: 2.0.18
Ruby version: 2.6.3
The text was updated successfully, but these errors were encountered: