- Metadata and upload options are now differently passed to storages, so the
new signature of
#movemethods on the storage class should be:
# ...end# ...end
Shrine::Confirmfunctionality has been removed from storages' specification, storages should update
clear!to remove the confirmation.
:delegateoption in migration_helpers now defaults to false.
The migration_helpers plugin has been deprecated,
Shrine::Attacher#stored?have been moved to base functionality.
The "background_helpers" alias for the backgrounding plugin has been deprecated and will be removed in Shrine 3.
In backgrounding plugin the "attachment" key has been renamed to "name", and "uploaded_file" has been renamed to "attachment" in the data hash in background job argument.
Shrine::Attacher.deletefrom backgrounding plugin now return a
Shrine::Attacherinstance instead of the model instance.
The moving plugin doesn't delete files that aren't movable anymore. You should use delete_raw and/or delete_promoted plugins for this functionality.
The deprecated "delete_uploaded" alias for delete_raw plugin has been removed.
The deprecated "restore_cached" alias for restore_cached_data plugin has been removed.
The deprecated keep_location plugin has been removed.
:subdirectoryoption in FileSystem storage has been removed.
Shrine#default_urlhas been removed (specifying a default URL by overriding
#default_urlon the uploader), the default_url plugin should be used instead.
Shrine::UploadEndpointin direct_upload plugin has been removed.
:presignoption in direct_upload plugin cannot be used for specifying presign options anymore;
:presign_optionsshould be used instead.
#assignmethods don't return the assigned uploaded file anymore.
Shrine::Attacher#delete!doesn't spawn a background job anymore with backgrounding plugin, plugin writers should switch to
The phases when files are internally deleted have been renamed.
Shrine doesn't officially support Rubinius anymore.
- The shrine-memory storage has been released, which saves uploaded files in memory (useful in tests).
- The built-in analyzers can now be used when implementing a custom MIME type analyzer in determine_mime_type plugin.
plugin :determine_mime_type, analyzer: ->(io, analyzers) doanalyzers[:mimemagic].call(io) || analyzers[:file].call(io)end
- The built-in analyzers can now be used when implementing a custom dimensions analyzer in store_dimensions plugin.
plugin :store_dimensions, analyzer: ->(io, analyzers) dodimensions = analyzers[:filemagic].call(io)dimensions || MiniMagick::Image.new(io).dimensionsend
#delete!are now public (they are wrappers for
Shrine#deletewith context passed in).
Shrine::Attacher#_deletehas been added as a wrapper around
#delete!, which the backgrounding plugin overrides and makes aynchronous. This nicely complements the
Shrine now prints a security warning when determine_mime_type plugin isn't loaded.
Don't error in determine_mime_type with
:mimemagicanalyzer when MimeMagic cannot determine MIME of the file.
:hostis given to S3 storage, URLs will now include the query parameters, unless
:publicis given, just like without
The Down version has been bumped to 2.2.0, which means the remote_url plugin now follows redirects (maximum of 2 redirects by default).
Shrine::Attacher#promotenow have the same generalized method signature.
The restore_cached_data plugin functionality won't get triggered anymore when form is submitted with already saved cached attachmnet (e.g. due to background processing).
The restore_cached_data plugin now doesn't check anymore if the cached file exists (which saves an HTTP request with remote storages).
The download_endpoint now makes only one HTTP request when downloading files from remote storages.
The activerecord plugin now allows attachment modules to be included in non-ActiveRecord models.
The sequel plugin now allows attachment modules to be included in non-Sequel models.
Plugin options are now persisted when reapplying plugins.
Shrine.plugin :download_endpoint, storages: [:store], prefix: "/downloads", disposition: "inline"# all other options above will be persistedplugin :download_endpoint, disposition: "attachment"end
:include_errorhas been removed from remote_url plugin, the error will now be included in the second argument depending on lambda's arity.
The dynamic_storage plugin doesn't cache the instantiated storages anymore, which enables use cases like storing storage definitions in the database.
The determine_mime_type plugin with
:fileanalyzer now handles filenames that start with a dash ("-").
Shrine::Attachernow allocates less strings.