Class: QcFilesController

Inherits:
ApplicationController show all
Defined in:
app/controllers/qc_files_controller.rb

Instance Method Summary collapse

Methods inherited from ApplicationController

#block_api_access, #clean_params_from_check, #evil_parameter_hack!, #extract_header_info, #set_cache_disabled!

Instance Method Details

#createObject


8
9
10
11
12
13
14
15
16
17
# File 'app/controllers/qc_files_controller.rb', line 8

def create
  qc_file = QcFile.new(qc_file_params)

  if qc_file.save
    redirect_to asset_path(qc_file.asset_id), notice: "#{qc_file.filename} was uploaded"
  else
    errors = qc_file.errors.full_messages.join(';').truncate(500, separator: ' ')
    redirect_to asset_path(qc_file.asset_id), alert: "#{qc_file.filename} could not be uploaded: #{errors}"
  end
end

#showObject


2
3
4
5
6
# File 'app/controllers/qc_files_controller.rb', line 2

def show
  QcFile.find(params[:id]).retrieve_file do |file|
    send_file file.path, content_type: file.content_type, filename: file.filename
  end
end