[ActiveStorage] Add an option to automatically replace an existing attachment for has_one_attached

31 views
Skip to first unread message

yv...@capsens.eu

unread,
Sep 8, 2017, 11:32:36 AM9/8/17
to Ruby on Rails: Core
Hello,

Do you think it could make sense to add an option to `has_one_attached`, so that any previous attachment is automatically purged (or purged later) when calling `attach`?

The syntax could be:

```
has_one_attached :attachment, previous_attachment: { :purge | :purge_later | :restrict_with_error | :restrict_with_exception }
```

This follows the question posted here: https://stackoverflow.com/questions/45870021/how-to-update-attachment-in-activestorage-rails-5-2/45933694#45933694

What do you think?
Reply all
Reply to author
Forward
0 new messages