Class: PlateSummariesController
- Inherits:
-
ApplicationController
- Object
- ActionController::Base
- ApplicationController
- PlateSummariesController
- Defined in:
- app/controllers/plate_summaries_controller.rb
Constant Summary
Constants included from FlashTruncation
FlashTruncation::STRING_OVERHEAD
Instance Method Summary collapse
- #index ⇒ Object
-
#search ⇒ Object
rubocop:todo Metrics/AbcSize.
- #show ⇒ Object
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
#index ⇒ Object
5 6 7 |
# File 'app/controllers/plate_summaries_controller.rb', line 5 def index @plates = Plate.source_plates.with_descendants_owned_by(current_user).order(id: :desc).page(params[:page]) end |
#search ⇒ Object
rubocop:todo Metrics/AbcSize
17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 |
# File 'app/controllers/plate_summaries_controller.rb', line 17 def search # rubocop:todo Metrics/AbcSize candidate_plate = Plate.(params[:plate_barcode]) @barcode = params[:plate_barcode] @plates = candidate_plate&.source_plates if @plates.blank? redirect_back fallback_location: root_path, flash: { error: "No suitable plates found for barcode #{params[:plate_barcode]}" } elsif @plates.one? redirect_to plate_summary_path(@plates.first.) else render :search end end |
#show ⇒ Object
9 10 11 12 13 14 15 |
# File 'app/controllers/plate_summaries_controller.rb', line 9 def show @plate = Plate.(params[:id]) raise ActiveRecord::RecordNotFound if @plate.nil? @custom_metadatum_collection = @plate. || NullCustomMetadatumCollection.new @sequencing_batches = @plate.descendant_lanes.include_creation_batches.map(&:creation_batches).flatten.uniq end |