Class: PlateSummariesController

Inherits:
ApplicationController show all
Defined in:
app/controllers/plate_summaries_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

#indexObject


4
5
6
# File 'app/controllers/plate_summaries_controller.rb', line 4

def index
  @plates = Plate.source_plates.with_descendants_owned_by(current_user).order(id: :desc).page(params[:page])
end

#searchObject


16
17
18
19
20
21
22
23
# File 'app/controllers/plate_summaries_controller.rb', line 16

def search
  candidate_plate = Plate.find_from_any_barcode(params[:plate_barcode])
  if candidate_plate.nil? || candidate_plate.source_plate.nil?
    redirect_back fallback_location: root_path, flash: { error: "No suitable plates found for barcode #{params[:plate_barcode]}" }
  else
    redirect_to plate_summary_path(candidate_plate.source_plate.human_barcode)
  end
end

#showObject


8
9
10
11
12
13
14
# File 'app/controllers/plate_summaries_controller.rb', line 8

def show
  @plate = Plate.find_from_any_barcode(params[:id])
  raise ActiveRecord::RecordNotFound if @plate.nil?

  @custom_metadatum_collection = @plate.custom_metadatum_collection || NullCustomMetadatumCollection.new
  @sequencing_batches = @plate.descendant_lanes.include_creation_batches.map(&:creation_batches).flatten.uniq
end