Class: QcFilesController

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

Constant Summary

Constants included from FlashTruncation

FlashTruncation::STRING_OVERHEAD

Instance Method Summary collapse

Methods inherited from ApplicationController

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

Methods included from FlashTruncation

#max_flash_size, #truncate_flash, #truncate_flash_array

Instance Method Details

#createObject



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

def create
  qc_file = QcFile.new(qc_file_params)

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

#showObject



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

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