instance method service_url

Ruby on Rails 5.2.8.1

Since v5.2.8.1 Last seen in v6.1.7.10

Available in: v5.2.8.1 v6.0.6 v6.1.7.10

Signature

service_url(expires_in: service.url_expires_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_in key = service.url_expires_in
disposition key = :inline
filename key = nil
options keyrest
Source
# File activestorage/app/models/active_storage/blob.rb, line 124
  def service_url(expires_in: service.url_expires_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 124 · 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