Active Storage Permanent Image URL

You can get the full URL of an Active Storage attachment using the following:

polymorphic_url(@article.image.variant(resize: '800x600'))

This will provide a full url and not just the path and works well on Rails 5.2+


Try rails_blob_url

rails_blob_url(image, disposition: "attachment")

Update: Link updated.


I think what you're after isn't easily possible. Active Storage doesn't seem to support permanent, non-expiring URLs: "Request has expired" when using S3 with Active Storage

Depending on your setup, there might be a useful and (mostly) hack-free workaround. In my case, I've set a custom show action on the record that owns the file I want to link to:

redirect_to url_for(@record_name.file)

Then, using a path helper for the record show action in my app, as usual, just renders the thing I want via the expiring url_for.