David Kimura PRO said over 2 years ago on Direct Upload Instantly :
  It should work without any modifications to this episode. I've pulled the code from this episode and updated a few things (using ruby 2.7.4, updated webpacker, updated mimemagic). These changes were really more related to my environment rather than changes required for the feature to work. No changes to the actual code and it allowed updating of existing images. Is your use case doing a has_one_attached or has_many_attached? If you have a has_many_attached situation, it becomes a bit more difficult. But, the has_one_attached works and it does clean up the previously uploaded image too.