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

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


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

def create
  @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
# File 'app/controllers/poolings_controller.rb', line 21

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