Sha256: 29b292a22db708c77a8c6b4ca658affd494937a944563bc93d629ced8dd7ee6b

Contents?: true

Size: 1.48 KB

Versions: 4

Compression:

Stored size: 1.48 KB

Contents

require_dependency "customer_vault/application_controller"

module CustomerVault
  class CorporationsController < ApplicationController
    before_action :set_corporation, only: [:show, :edit, :update, :destroy]

    # GET /corporations
    def index
      @corporations = Corporation.all
    end

    # GET /corporations/1
    def show
    end

    # GET /corporations/new
    def new
      @corporation = Corporation.new
    end

    # GET /corporations/1/edit
    def edit
    end

    # POST /corporations
    def create
      @corporation = Corporation.new(corporation_params)

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

    # PATCH/PUT /corporations/1
    def update
      if @corporation.update(corporation_params)
        redirect_to @corporation, notice: 'Corporation was successfully updated.'
      else
        render action: 'edit'
      end
    end

    # DELETE /corporations/1
    def destroy
      @corporation.destroy
      redirect_to corporations_url, notice: 'Corporation was successfully destroyed.'
    end

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

      # Only allow a trusted parameter "white list" through.
      def corporation_params
        params.require(:corporation).permit(:name, :email, :phone, :fax)
      end
  end
end

Version data entries

4 entries across 4 versions & 1 rubygems

Version Path
customer_vault-0.0.4 app/controllers/customer_vault/corporations_controller.rb
customer_vault-0.0.3 app/controllers/customer_vault/corporations_controller.rb
customer_vault-0.0.2 app/controllers/customer_vault/corporations_controller.rb
customer_vault-0.0.1 app/controllers/customer_vault/corporations_controller.rb