Method: ActiveStorage::Preview#url
- Defined in:
- activestorage/app/models/active_storage/preview.rb
#url(**options) ⇒ Object
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.
68 69 70 71 72 73 74 |
# File 'activestorage/app/models/active_storage/preview.rb', line 68 def url(**) if processed? presentation.url(**) else raise UnprocessedError end end |