instance method url

Ruby on Rails 8.0.4

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(**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 URL returned by this method.

Parameters

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

Defined in activestorage/app/models/active_storage/preview.rb line 68 · 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