—
title: Shrine 3.1.0¶ ↑
New features¶ ↑
-
The
Attacher#create_derivativesmethod now accepts a:storageoption for specifying the storage to which derivatives should be uploaded.
“‘rb # with attachment module photo.image_derivatives!(storage: :other_store)
# with attacher attacher.create_derivatives(storage: :other_store) “‘
-
The
Shrine.calculate_signaturenow accepts a:rewindboolean option for choosing whether the IO object should be rewinded after reading. This is useful if you want to calculate signature from non-rewindable IO objects, such asIO.pipe,Socket, non-rewindableDown::ChunkedIOetc.
rb Shrine.signature(io, rewind: false)
Improvements¶ ↑
-
The derivatives processor can now be registered with
Attacher.derivatives, which is just an alias forAttacher.derivatives_processor.
“‘rb class ImageUploader < Shrine Attacher.derivatives_processor do |original| # … end end
# can now be written as
class ImageUploader < Shrine Attacher.derivatives do |original| # … end end “‘
-
The
Attacher#cached?andAttacher#stored?methods now work correctly if temporary/permanent storage identifiers were specified as strings. -
The
store_dimensionsplugin now properly propagates exceptions when loading theruby-vipsgem in:vipsanalyzer. -
The
add_metadataplugin now respects inheritance again when defining metadata methods on theShrine::UploadedFileclass. In 2.19.0, theadd_metadataplugin was changed to define metadata methods on the internalFileMethodsplugin module, which is shared across all uploaders. This change has now been reverted.
Backwards compatibility¶ ↑
-
The
Attacher#cache_keyandAttacher#store_keymethods now always return symbol keys, even if the storage key that was specified was a string key.
rb attacher = Shrine::Attacher.new(cache: "cache", store: "store") attacher.cache_key #=> :cache (previously "cache") attacher.store_key #=> :store (previously "store")
-
The
add_metadataplugin now defines metadata methods directly on theUploadedFileclass, which means that if you happen to have been overriding these metadata methods and callingsuper, this won’t work anymore.