Shrine (v2.5.0)

File Attachment toolkit for Ruby applications attachment

README

Plugins

ORM

activerecord:
Provides ActiveRecord integration, adding callbacks and validations.
sequel:
Provides Sequel integration, adding callbacks and validations.

Model

backgrounding:
Adds the ability to put storing and deleting into a background job.
cached_attachment_data:
Adds a convenient model method for the hidden form cache field.
copy:
Allows copying attachments from one record to another.
data_uri:
Adds ability to upload files via a data URI.
default_url:
Allows setting the URL which will be returned on missing attachments.
included:
Allows the included attachments to define additional methods on the model.
parsed_json:
Allows assigning cached files as hashes/arrays (on top of JSON strings).
remote_url:
Allows your models to accept attachments as remote URLs.
remove_attachment:
Allows you to remove the attachment via a form field.
validation_helpers:
Gives you convenient methods for validating file's metadata.

Processing

parallelize:
Allows you to parallelize uploads and deletes when using versions.
processing:
Allows you to define processing performed for a specific action.
recache:
Allows you to do additional processing before the background job.
versions:
Gives uploader class the ability to handle processed versions of a file.

Metadata

add_metadata:
Allows extracting additional metadata values.
determine_mime_type:
Allows you to determine the actual MIME type from file contents.
restore_cached_data:
Re-extracts cached file's metadata on model assignment.
store_dimensions:
Allows you to store image dimensions as additional metadata.

Deleting

delete_promoted:
Deletes promoted files after the record has been updated.
delete_raw:
Automatically deletes raw files after they've been uploaded.
keep_files:
Allows you to keep files on the storage that would otherwise be deleted.
multi_delete:
Allows you to delete multiple files at once, which some storages optimize.
remove_invalid:
Automatically deletes and deassigns the assigned cached file if it's invalid.

Storage

backup:
Uploads stored files to an additional "backup" storage.
default_storage:
Allows you to choose different storages for different attachments.
dynamic_storage:
Allows you to define storages dynamically based on their identifier.
moving:
Allows you to move files to storages instead of copying them.
pretty_location:
Generates a more organized directory structure on the storage.

Other

default_url_options:
Allows you to specify default URL options for uploaded files.
direct_upload:
Provides a Rack endpoint convenient for direct AJAX uploads.
download_endpoint:
Generates URLs to uploaded files which normally may not be accessible over URL.
hooks:
Allows you to specify actions that occur before/around/after process/store/delete.
logging:
Automatically logs processing, storing and deleting, with a configurable format.
module_include:
Allows easy extending of core classes for a given uploader.
rack_file:
Enables uploaders to accept Rack uploaded file hashes for uploading.
upload_options:
Allows dynamically creating and forwarding storage-specific upload options.

Release notes

External