Skip to content

Commit

Permalink
Merge pull request #42510 from p8/guides/activestorage-redirect-mode
Browse files Browse the repository at this point in the history
Improve "Serving Files" headings [ci skip]
  • Loading branch information
zzak committed Jun 16, 2021
2 parents f8e45f9 + f12fae3 commit 40c0a5e
Showing 1 changed file with 6 additions and 3 deletions.
9 changes: 6 additions & 3 deletions guides/source/active_storage_overview.md
Expand Up @@ -532,16 +532,19 @@ user.avatar.purge_later
[Attached::One#purge]: https://api.rubyonrails.org/classes/ActiveStorage/Attached/One.html#method-i-purge
[Attached::One#purge_later]: https://api.rubyonrails.org/classes/ActiveStorage/Attached/One.html#method-i-purge_later

Linking to Files
----------------
Serving Files
-------------

Active Storage supports two ways to serve files: redirecting and proxying.

### Redirect mode

To generate a permanent URL for a blob, you can pass the blob to the
[`url_for`][ActionView::RoutingUrlFor#url_for] view helper. This generates a
URL with the blob's [`signed_id`][ActiveStorage::Blob#signed_id]
that is routed to the blob's
[`RedirectController`](ActiveStorage::Blobs::RedirectController).


```ruby
url_for(user.avatar)
# => /rails/active_storage/blobs/:signed_id/my-avatar.png
Expand Down

0 comments on commit 40c0a5e

Please sign in to comment.