Class: Keinaufwand::AssetsController

Inherits:
ActionController::Base
  • Object
show all
Defined in:
lib/keinaufwand/assets_controller.rb

Instance Method Summary collapse

Instance Method Details

#showObject



3
4
5
6
7
8
9
10
# File 'lib/keinaufwand/assets_controller.rb', line 3

def show
  asset = Asset.find(params[:id])

  if stale?(etag: asset.checksum, last_modified: asset.synced_at, public: true)
    expires_in 1.year, public: true
    send_data asset.data, type: asset.content_type, disposition: "inline"
  end
end