Sha256: 3072c732333ea125e627ebfd3225a54d7ec3d996bd3630f558915f9a83c2d8c3

Contents?: true

Size: 571 Bytes

Versions: 5

Compression:

Stored size: 571 Bytes

Contents

require 'sufia/noid'

class DownloadsController < ApplicationController
  include Sufia::Noid # for normalize_identifier method

  def generic_file
    @generic_file ||= GenericFile.find(params[:id])
  end
  before_filter :generic_file
  prepend_before_filter :normalize_identifier, except: [:index, :new, :create]
  load_and_authorize_resource :generic_file, class: "GenericFile"

  def show
    send_data(
      generic_file.content.content,
      type: generic_file.content.mimeType,
      filename: generic_file.filename,
      disposition: 'inline'
    )
  end

end

Version data entries

5 entries across 5 versions & 1 rubygems

Version Path
curate-0.2.0 app/controllers/downloads_controller.rb
curate-0.1.3 app/controllers/downloads_controller.rb
curate-0.1.2 app/controllers/downloads_controller.rb
curate-0.1.1 app/controllers/downloads_controller.rb
curate-0.1.0 app/controllers/downloads_controller.rb