-
Notifications
You must be signed in to change notification settings - Fork 183
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
Updating record with nested ActiveStorage attachments fails #532
Comments
Hm, this is interesting. As you might've seen in Reform's source, all |
I believe To be honest I feel that calling Am I correct to assume that the relevant |
Actually, I believe that Disposable only calls the setter if the value has changed, but I might be wrong. In your case, whatsoever, the problem seems to be the |
Or, wait a minute, did you say that |
Yes, calling |
@akz92 could you try assigning |
@yogeshjain999 yes that does work as |
Cool 🍻 Closing this issue. |
@yogeshjain999 I'm sorry if it sounded like that solves the initial issue. The discussion about |
@akz92 Could you try this? https://github.com/apotonick/disposable/blob/master/lib/disposable/twin/sync.rb#L133 This module included in the |
@apotonick good call, that does in fact solve the issue! Please let me know if/how I can help either document or fix it for good. Thank you both very much for the prompt attention to this issue! |
I'm afraid I jumped to conclusions too soon. Adding |
Hm, that sounds like unintended behavior (a "bug"). Can you check disposable's tests if we cover collections where only one property is changed in combo with |
Complete Description of Issue
Given a form with a nested collection where each element of the collection has an ActiveStorage attachment, calling
.sync
or.save
fails on update without changing at least one of the attached files.This started happening with Rails 6.1 and is possibly linked to this addition
Steps to reproduce
I have created a tiny Rails app that reproduces this in isolation, the steps to try it are in the README.
Simplified scenario that would cause the issue:
Expected behavior
The record should be synced/saved.
Actual behavior
Fails with
Could not find or build blob: expected attachable, got ActiveStorage::Attachable::One
System configuration
Reform version: 2.6.0
Rails version: 6.1.4
Full Backtrace of Exception (if any)
The text was updated successfully, but these errors were encountered: