Class: Shimmer::FilesController
- Inherits:
-
ActionController::Base
- Object
- ActionController::Base
- Shimmer::FilesController
- Defined in:
- lib/shimmer/controllers/files_controller.rb
Instance Method Summary collapse
Instance Method Details
#show ⇒ Object
5 6 7 8 9 10 11 12 13 14 15 16 17 18 |
# File 'lib/shimmer/controllers/files_controller.rb', line 5 def show expires_in 1.year, public: true request.[:skip] = true # prevents a session cookie from being set (would prevent caching on CDNs) proxy = FileProxy.restore(params.require(:id)) send_data( proxy.file, filename: proxy.filename.to_s, type: proxy.content_type, disposition: "inline" ) rescue ActiveRecord::RecordNotFound, ActiveStorage::FileNotFoundError head :not_found end |