Sha256: 6cd6d959b6302a455c8afd951852af00f859c1b2a853d2796483bca363b04542

Contents?: true

Size: 1.12 KB

Versions: 1

Compression:

Stored size: 1.12 KB

Contents

require_dependency "tang/application_controller"

module Tang
  class Admin::CustomersController < Admin::ApplicationController
    before_action :set_customer, only: [:show, :edit, :update, :destroy]

    # GET /customers
    def index
      @customers = User.order(:email)
    end

    # GET /customers/1
    def show
    end

    # GET /customers/1/edit
    def edit
    end

    # PATCH/PUT /customers/1
    def update
      if @customer.update(customer_params)
        redirect_to admin_customer_path(@customer), notice: 'Customer was successfully updated.'
      else
        render :edit
      end
    end

    # DELETE /customers/1
    def destroy
      @customer.destroy
      redirect_to admin_customers_url, notice: 'Customer was successfully destroyed.'
    end

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

      # Only allow a trusted parameter "white list" through.
      def customer_params
        params.require(:user).permit(:email, :account_balance, :business_vat_id, :description)
      end
  end
end

Version data entries

1 entries across 1 versions & 1 rubygems

Version Path
tang-0.0.1 app/controllers/tang/admin/customers_controller.rb