after_assign's copy_to doesn't fire when using retained_image
Author: rdunlopCreated Oct 3, 2019Updated Oct 3, 2019
My model has 2 attachments
- original_uid
- image_uid
dragonfly_accessor :original do
copy_to :image
end
dragonfly_accessor :image do
after_assign :process_image
endI am also using retained_original in my form.
The problem seems to be that:
- If I upload a graphic, and submit the form
- And the form Fails validation (thus filling the retained_original)
- And then I fix the form issue
- When I submit the form, the
original_uidis set but theimage_uidis NOT set.
Based on reading the source code it looks like the "retained_#{attribute}=" method does not go through the dragonfly_attachments[attribute].assign(value) path, which prevents the after_assign callback from being fired.
My only idea right now is to remove the retained_original usage, since this is causing my models to end up in an unexpected situation.
Please let me know if I'm using these 2 features together incorrectly.
Source: markevans/dragonfly