module Shrine::Plugins::DefaultStorage

  1. lib/shrine/plugins/default_storage.rb

The default_storage plugin enables you to change which storages are going to be used for this uploader's attacher (the default is :cache and :store).

plugin :default_storage, cache: :special_cache, store: :special_store

You can also pass a block and choose the values depending on the record values and the name of the attachment. This is useful if you're using the dynamic_storage plugin. Example:

plugin :default_storage, store: ->(record, name) { :"store_#{record.username}" }


Public Class

  1. configure

Public Class methods

configure (uploader, opts = {})
[show source]
# File lib/shrine/plugins/default_storage.rb, line 17
def self.configure(uploader, opts = {})
  uploader.opts[:default_storage_cache] = opts.fetch(:cache, uploader.opts[:default_storage_cache])
  uploader.opts[:default_storage_store] = opts.fetch(:store, uploader.opts[:default_storage_store])