Class: ActiveStorage::Blobs::RedirectController

Inherits:
ActiveStorage::BaseController
  • Object
show all
Includes:
SetBlob
Defined in:
app/controllers/active_storage/blobs/redirect_controller.rb

Overview

Take a signed permanent reference for a blob and turn it into an expiring service URL for download.

WARNING: All Active Storage controllers are publicly accessible by default. The generated URLs are hard to guess, but permanent by design. If your files require a higher level of protection consider implementing Authenticated Controllers.

Instance Method Summary collapse

Instance Method Details

#showObject



12
13
14
15
# File 'app/controllers/active_storage/blobs/redirect_controller.rb', line 12

def show
  expires_in ActiveStorage.service_urls_expire_in
  redirect_to @blob.url(disposition: params[:disposition]), allow_other_host: true
end