Skip to content

Commit

Permalink
Mention that keep_files plugin keeps derivatives as well
Browse files Browse the repository at this point in the history
Closes #553
  • Loading branch information
janko committed Sep 25, 2021
1 parent cf723e7 commit 6b7959e
Showing 1 changed file with 6 additions and 4 deletions.
10 changes: 6 additions & 4 deletions doc/plugins/keep_files.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,10 +2,11 @@
title: Keep Files
---

The [`keep_files`][keep_files] plugin prevents file deletion when the attacher
is about to destroy currently attached or previously attached file. This
functionality is useful when implementing soft deletes, versioning, or in
general any scenario where you need to track history.
The [`keep_files`][keep_files] plugin prevents the attached file (and any of
its [derivatives]) from being deleted when the attachment would normally be
destroyed, which happens when the attachment is removed/replaced, or when the
record is deleted. This functionality is useful when implementing soft deletes,
versioning, or in general any scenario where you need to keep history.

```rb
plugin :keep_files
Expand All @@ -17,3 +18,4 @@ photo.image.exists? #=> true
```

[keep_files]: https://github.com/shrinerb/shrine/blob/master/lib/shrine/plugins/keep_files.rb
[derivatives]: https://shrinerb.com/docs/plugins/derivatives

0 comments on commit 6b7959e

Please sign in to comment.