Skip to content

after_assign's copy_to doesn't fire when using retained_image #503

@rdunlop

Description

@rdunlop

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
    end

I 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_uid is set but the image_uid is 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.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions