—
title: Shrine 1.3.0¶ ↑
New features¶ ↑
- 
Added :namespaceoption to pretty_location plugin for including the model namespace into the location.
- 
Addded :include_erroroption to remote_url plugin which gives you access to the download error instance when generating the error message.
- 
Added <attachment>_cached?and<attachment>_stored?to migration_helpers for easier handling of uploading logic in ORM hooks:
class Photo < Sequel::Model def before_save if column_changed?(:image) && image_stored? # promote # ... end super end end
Other improvements¶ ↑
- 
Fixed uploading an S3 file making an additional unneeded GET request in addition to the S3 COPY request. 
- 
When the model with an attachment is namespaced, the namespace isn't included in the location anymore when using the pretty_location plugin. 
- 
Dumped Down version to 2.0.0 to fix downloading files from URLs which have "[]" characters in them. 
- 
The IO is now rewinded even if FastImage fails to extract dimensions from the IO 
- 
The IO is now rewinded when using MimeMagic to extract the MIME type. 
- 
When uploading a Shrine::UploadedFile, the default location generator will first look for the extension in#idbefore looking at#original_filename.
- 
The remote_url plugin now returns separate error messsages when file wasn't found and when the file was too large. 
- 
Fixed promoting raising an error if the record got deleted before promoting finished 
- 
UploadedFile#original_filename,#sizeand#content_typenow returnnilwhen corresponding metadata keys are missing instead of raising aKeyError.
- 
Fixed errors being able to accumulate on the record object when errors occur in data_uri and remote_url plugins. 
- 
The "metadata" key isn't required anymore when instantiating a Shrine::UploadedFile.
- 
The top-level key-values aren't cached anymore when instantiating a Shrine::UploadedFile, which means that#id,#storage_keyand#metadatawill now pick up any mutations on the data hash.
- 
Removed a deprecation warning in the S3 storage which occurs when AWS credentials are inferred implicitly. 
- 
The extracted metadata is now accessible inside Shrine#generate_locationvia the:metadatakey in thecontexthash.
- 
Shrine#uploaddoesn’t mutate the given context hash anymore.
- 
Shrine::Attacher#backup_filefrom the backup plugin doesn’t modify the inputUploadedFileanymore.
Deprecations¶ ↑
- 
The keep_location plugin is deprecated, as the same behaviour can easily be achieved by overriding Shrine#generate_location:
class ImageUploader < Shrine def generate_location(io, context) if io.is_a?(UploadedFile) && context[:phase] == :store io.id else super end end end