Class: ReportFailsController

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

Overview

Controller for reporting failed labware

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

rubocop:todo Metrics/MethodLength



12
13
14
15
16
17
18
19
20
21
22
23
24
# File 'app/controllers/report_fails_controller.rb', line 12

def create # rubocop:todo Metrics/AbcSize
  @report_fail =
    ReportFail.new(
      params_for_report_fails[:user_code],
      params_for_report_fails[:failure_id],
      params_for_report_fails[:barcodes]
    )
  if @report_fail.save
    flash.now[:notice] = 'Failure saved'
  else
    flash.now[:error] = @report_fail.errors.full_messages.join('; ')
  end
end

#indexObject



7
8
9
# File 'app/controllers/report_fails_controller.rb', line 7

def index
  @report_fail = ReportFail.new(nil, nil, [])
end