instance method url

Ruby on Rails 7.1.6

Since v6.1.7.10

Available in: v6.1.7.10 v7.0.10 v7.1.6 v7.2.3 v8.0.4 v8.1.2

Signature

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_in key = ActiveStorage.service_urls_expire_in
disposition key = :inline
filename key = nil
options keyrest
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

Type at least 2 characters to search.

↑↓ navigate · open · esc close