--
You received this message because you are subscribed to the Google Groups "Shrine" group.
To unsubscribe from this group and stop receiving emails from it, send an email to ruby-shrine...@googlegroups.com.
To post to this group, send email to ruby-...@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/ruby-shrine/56690981-95e5-428b-8bb9-fe9317eccd1f%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.
require "securerandom"
id = SecureRandom.hex
presign = Shrine.storages[:cache].presign(id, {...})
presign.url #=> "https://my-bucket.s3.amazonaws.com/..."
presign.fields #=> {...}
--
You received this message because you are subscribed to the Google Groups "Shrine" group.
To unsubscribe from this group and stop receiving emails from it, send an email to ruby-shrine+unsubscribe@googlegroups.com.
To post to this group, send email to ruby-...@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/ruby-shrine/6e817bf5-96e5-46f9-8657-d6f6b81ba315%40googlegroups.com.
default_url_options = lambda do |io, **options|
attachment_download_type = options.key?(:download) ? "attachment" : "inline"
{
response_content_disposition: ContentDisposition.format(disposition: attachment_download_type, filename: io.original_filename),
response_content_type: io.mime_type
}
end
Shrine.plugin :default_url_options, cache: default_url_options, store: default_url_options
default_url_options = lambda do |io, **options|
disposition = options.fetch(:response_content_disposition, "inline")
{
response_content_disposition: ContentDisposition.format(disposition: disposition, filename: io.original_filename),
response_content_type: io.mime_type
}
end
Shrine.plugin :default_url_options, cache: default_url_options, store: default_url_options