<commit_before>class CargosController < ApplicationController
  
  # GET /cargos
  def index
    @prez = Cmds::CargoQuery.new.call 
  end 

  # GET /cargos/1
  def show
    load_cargo
  end

  # GET /cargos/new
  def new
    @prez = CargoPresenter.new
  end

  # GET /cargos/1/edit
  def edit
    load_cargo
  end

  # POST /cargos
  def create
    cargo = Cargo.new(cargo_params)
    @prez = CargoPresenter.new(cargo)

    if cargo.save
      redirect_to cargo, notice: 'Cargo was successfully created.'
    else
      render :new
    end
  end

  # PATCH/PUT /cargos/1
  def update
    cargo = load_cargo

    if cargo.update(cargo_params)
      redirect_to cargo, notice: 'Cargo was successfully updated.'
    else
      render :edit
    end
  end

  # DELETE /cargos/1
  def destroy
    cargo = load_cargo
    cargo.destroy
    redirect_to cargos_url, notice: 'Cargo was successfully destroyed.'
  end

  private
    def load_cargo
      @prez= Cmds::CargoFind.new(params[:id]).call
      @prez.target
    end

    # Only allow a trusted parameter "white list" through.
    def cargo_params 
      params.require(:cargo).permit(:origin_id, :destination_id, :arrival_deadline_on)
    end
end<commit_msg>prep for adding cmds<commit_after>class CargosController < ApplicationController
  
  # GET /cargos
  def index
    @prez = Cmds::CargoQuery.new.call 
  end 

  # GET /cargos/1
  def show
    @prez = Cmds::CargoFind.new(params[:id]).call   
  end

  # GET /cargos/new
  def new
    @prez = CargoPresenter.new
  end

  # GET /cargos/1/edit
  def edit
    @prez = Cmds::CargoFind.new(params[:id]).call   
  end

  # POST /cargos
  def create
    cargo = Cargo.new(cargo_params)
    @prez = CargoPresenter.new(cargo)

    if cargo.save
      redirect_to cargo, notice: 'Cargo was successfully created.'
    else
      render :new
    end
  end

  # PATCH/PUT /cargos/1
  def update
    @prez = Cmds::CargoFind.new(params[:id]).call   
    cargo = @prez.target
    if cargo.update(cargo_params)
      redirect_to cargo, notice: 'Cargo was successfully updated.'
    else
      render :edit
    end
  end

  # DELETE /cargos/1
  def destroy
    @prez = Cmds::CargoFind.new(params[:id]).call   
    @prez.target.destroy
    redirect_to cargos_url, notice: 'Cargo was successfully destroyed.'
  end

  private
    # Only allow a trusted parameter "white list" through.
    def cargo_params 
      params.require(:cargo).permit(:origin_id, :destination_id, :arrival_deadline_on)
    end
end
{'fraction_non_alphanumeric': 0.09083601286173633, 'fraction_numerical': 0.003215434083601286, 'mean_word_length': 2.638888888888889, 'pattern_counts': {'":': 0, '<': 5, '<?xml version=': 0, '>': 3, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '7469391', 'n_tokens_mistral': 907, 'n_tokens_neox': 881, 'n_words': 216}