Class: PoolingsController

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

Overview

ALlows the creation of a new MultiplexedLibraryTube from one or more arbitrary tubes

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/AbcSize



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

def create # rubocop:todo Metrics/AbcSize
  @pooling = Pooling.new(pooling_params.merge(barcode_printer: params[:printer]))
  if @pooling.valid?
    @pooling.execute
    flash.update(@pooling.message)
    redirect_to new_pooling_path
  else
    flash.now[:error] = @pooling.errors.full_messages
    render :new
  end
end

#newObject



5
6
7
# File 'app/controllers/poolings_controller.rb', line 5

def new
  @pooling = Pooling.new(pooling_params)
end

#pooling_paramsObject



21
22
23
24
25
# File 'app/controllers/poolings_controller.rb', line 21

def pooling_params
  if params[:pooling].present?
    params.require(:pooling).permit(:stock_mx_tube_required, :count, :barcode_printer, barcodes: [])
  end
end