Class: ActiveStorage::DiskController

Inherits:
ActionController::Base
  • Object
show all
Defined in:
lib/active_storage/disk_controller.rb

Instance Method Summary collapse

Instance Method Details

#showObject



8
9
10
11
12
13
14
15
16
17
18
# File 'lib/active_storage/disk_controller.rb', line 8

def show
  if key = decode_verified_key
    blob = ActiveStorage::Blob.find_by!(key: key)
    
    if stale?(etag: blob.checksum)
      send_data blob.download, filename: blob.filename, type: blob.content_type, disposition: disposition_param
    end
  else
    head :not_found
  end
end