Sha256: 810574ed04f49804902762a9d1724c7a738bfe7e0e32385e139b27ccea087af0

Contents?: true

Size: 1.26 KB

Versions: 2

Compression:

Stored size: 1.26 KB

Contents

class ShipmentsController < ApplicationController
  before_action :set_shipment, only: [:show, :edit, :update, :destroy]

  # GET /shipments
  def index
    @shipments = Shipment.all
  end

  # GET /shipments/1
  def show
  end

  # GET /shipments/new
  def new
    @shipment = Shipment.new
  end

  # GET /shipments/1/edit
  def edit
  end

  # POST /shipments
  def create
    @shipment = Shipment.new(shipment_params)

    if @shipment.save
      redirect_to @shipment, notice: 'Shipment was successfully created.'
    else
      render action: 'new'
    end
  end

  # PATCH/PUT /shipments/1
  def update
    if @shipment.update(shipment_params)
      redirect_to @shipment, notice: 'Shipment was successfully updated.'
    else
      render action: 'edit'
    end
  end

  # DELETE /shipments/1
  def destroy
    @shipment.destroy
    redirect_to shipments_url, notice: 'Shipment was successfully destroyed.'
  end

  private
    # Use callbacks to share common setup or constraints between actions.
    def set_shipment
      @shipment = Shipment.find(params[:id])
    end

    # Only allow a trusted parameter "white list" through.
    def shipment_params
      params.require(:shipment).permit(:order_line_id, :shipping_date, :shipping_quantity, :arriving_date, :status)
    end
end

Version data entries

2 entries across 2 versions & 1 rubygems

Version Path
ext_form-0.1.5 spec/dummy/app/controllers/shipments_controller.rb
ext_form-0.1.4 spec/dummy/app/controllers/shipments_controller.rb