W3cubDocs

/Ruby on Rails 7.0

class ActiveStorage::Representations::ProxyController

Parent:
ActiveStorage::Representations::BaseController

Proxy files through application. This avoids having a redirect and makes files easier to cache.

WARNING: All Active Storage controllers are publicly accessible by default. The generated URLs are hard to guess, but permanent by design. If your files require a higher level of protection consider implementing Authenticated Controllers.

Public Instance Methods

show() Show source
# File activestorage/app/controllers/active_storage/representations/proxy_controller.rb, line 10
def show
  http_cache_forever public: true do
    send_blob_stream @representation.image, disposition: params[:disposition]
  end
end

© 2004–2021 David Heinemeier Hansson
Licensed under the MIT License.