Class: Shrine::Plugins::KithePersistedDerivatives

Inherits:
Object
  • Object
show all
Defined in:
lib/shrine/plugins/kithe_persisted_derivatives.rb

Overview

Some convenience methods for adding/changing derivatives in concurrency-safe manner:

* Won't make a change if the underlying original has changed
  so doesn't match the one you wanted to remove.
* Won't over-write changes made concurrently in the db by other processes
* Will always make sure to clean up any temporary files on all error
  and falure conditions.

Shrine has some building blocks for this, which we use, but it’s a bit tricky to put them together to be generically reliable, as we think we’ve done here.

All these methods will cause your Asset model to be saved, because of how the shrine atomic helpers work. So these methods will by default raise a TypeError if your Asset model has any unrelated outstanding changes, but you can tell it to save anyway with ‘allow_other_changes: true`.

## Shrine references:

shrinerb.com/docs/plugins/derivatives shrinerb.com/docs/processing

Defined Under Namespace

Modules: AttacherMethods