instance method
url
Ruby on Rails 6.1.7.10
Since v5.2.8.1Signature
url(key, **options)
Returns the URL for the file at the key. This returns a permanent URL for public files, and returns a short-lived URL for private files. For private files you can provide the disposition (:inline or :attachment), filename, and content_type that you wish the file to be served with on request. Additionally, you can also provide the amount of seconds the URL will be valid for, specified in expires_in.
Parameters
-
keyreq -
optionskeyrest
Source
# File activestorage/lib/active_storage/service.rb, line 112
def url(key, **options)
instrument :url, key: key do |payload|
generated_url =
if public?
public_url(key, **options)
else
private_url(key, **options)
end
payload[:url] = generated_url
generated_url
end
end
Defined in activestorage/lib/active_storage/service.rb line 112
· View on GitHub
· Improve this page
· Find usages on GitHub
Defined in ActiveStorage::Service