instance method
url
Ruby on Rails 7.2.3
Since v6.1.7.10Signature
url(expires_in: ActiveStorage.service_urls_expire_in, disposition: :inline, filename: nil, **options)
Returns the URL of the blob on the service. This returns a permanent URL for public files, and returns a short-lived URL for private files. Private files are signed, and not for public use. Instead, the URL should only be exposed as a redirect from a stable, possibly authenticated URL. Hiding the URL behind a redirect also allows you to change services without updating all URLs.
Parameters
-
expires_inkey = ActiveStorage.service_urls_expire_in -
dispositionkey = :inline -
filenamekey = nil -
optionskeyrest
Source
# File activestorage/app/models/active_storage/blob.rb, line 215
def url(expires_in: ActiveStorage.service_urls_expire_in, disposition: :inline, filename: nil, **options)
service.url key, expires_in: expires_in, filename: ActiveStorage::Filename.wrap(filename || self.filename),
content_type: content_type_for_serving, disposition: forced_disposition_for_serving || disposition, **options
end
Defined in activestorage/app/models/active_storage/blob.rb line 215
· View on GitHub
· Improve this page
· Find usages on GitHub
Defined in ActiveStorage::Blob