ActiveStorageは画像変更時に前のデータを変更しなくていい理由
ActiveStorage::PurgeJobというのがある
どうやらhas_one_attached にdependent: :purge_laterが設定されているので、古い画像は削除してくれるみたい
https://api.rubyonrails.org/v8.0/classes/ActiveStorage/Attached/Model.html#method-i-has_one_attached
流れ
after_destroy_commit
https://github.com/rails/rails/blob/1dd82aba340e8a86799bd97fe5ff2644c6972f9f/activestorage/app/models/active_storage/attachment.rb#L37
↓
purge_dependent_blob_later
https://github.com/rails/rails/blob/1dd82aba340e8a86799bd97fe5ff2644c6972f9f/activestorage/app/models/active_storage/attachment.rb#L150-L152
↓
ActiveStorage::Blobのperform_later
https://github.com/rails/rails/blob/1dd82aba340e8a86799bd97fe5ff2644c6972f9f/activestorage/app/models/active_storage/blob.rb#L338-L340