instance method
service_url
Ruby on Rails 6.0.6
Since v5.2.8.1 Last seen in v6.1.7.10Signature
service_url(expires_in: ActiveStorage.service_urls_expire_in, disposition: :inline, filename: nil, **options)
Returns the URL of the blob on the service. This URL is intended to be short-lived for security and not used directly with users. Instead, the service_url should only be exposed as a redirect from a stable, possibly authenticated URL. Hiding the service_url behind a redirect also gives you the power to change services without updating all URLs. And it allows permanent URLs that redirect to the service_url to be cached in the view.
Parameters
-
expires_inkey = ActiveStorage.service_urls_expire_in -
dispositionkey = :inline -
filenamekey = nil -
optionskeyrest
Source
# File activestorage/app/models/active_storage/blob.rb, line 150
def service_url(expires_in: ActiveStorage.service_urls_expire_in, disposition: :inline, filename: nil, **options)
filename = ActiveStorage::Filename.wrap(filename || self.filename)
service.url key, expires_in: expires_in, filename: filename, content_type: content_type_for_service_url,
disposition: forced_disposition_for_service_url || disposition, **options
end
Defined in activestorage/app/models/active_storage/blob.rb line 150
· View on GitHub
· Improve this page
· Find usages on GitHub
Defined in ActiveStorage::Blob