You are an expert in writing code in many different languages. Your goal is to perform code completion for the following code, keeping in mind the rest of the code and the file meta data.
    Metadata details:
    filename: plate_summaries_controller.rb
    path of file: ./repos/sequencescape/app/controllers
    
    the code of the file until where you have to start completion: # frozen_string_literal: true
class PlateSummariesController < ApplicationController
  before_action :login_required

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

  def show
    @plate = Plate.find_from_any_barcode(par
    
  def search # rubocop:todo Metrics/AbcSize
    candidate_plate = Plate.find_from_any_barcode(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.human_barcode)
    else
      render :search
    end