instance method service_url

Ruby on Rails 6.0.6

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(**options)

Returns the URL of the preview’s variant on the service. Raises ActiveStorage::Preview::UnprocessedError if the preview has not been processed yet.

This method synchronously processes a variant of the preview image, so do not call it in views. Instead, generate a stable URL that redirects to the short-lived URL returned by this method.

Parameters

options keyrest
Source
# File activestorage/app/models/active_storage/preview.rb, line 60
  def service_url(**options)
    if processed?
      variant.service_url(**options)
    else
      raise UnprocessedError
    end
  end

Defined in activestorage/app/models/active_storage/preview.rb line 60 · View on GitHub · Improve this page · Find usages on GitHub

Defined in ActiveStorage::Preview

Type at least 2 characters to search.

↑↓ navigate · open · esc close