1
0

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?

More than 3 years have passed since last update.

ActiveStorageでファイルを追加保存する

Last updated at Posted at 2020-08-19

Rails6.0以上だとActiveStorageはupdateの処理をかけた時に既存のファイルが削除された後に処理が走ります。
6.0以上だとしたのは、それ未満だと逆に追加処理になるためです。

アップグレード対応等で6.0未満の動きをして欲しい場合、以下の対応をすれば良さそうです。

config.active_storage.replace_on_assign_to_many = false

参照: https://github.com/rails/rails/pull/36716

1
0
0

Register as a new user and use Qiita more conveniently

  1. You get articles that match your needs
  2. You can efficiently read back useful information
  3. You can use dark theme
What you can do with signing up
1
0

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?