Sha256: db8233d4614d12db2a0d65748bc56578e1846c85ac33c6a214e35fe2ecb7c5c0

Contents?: true

Size: 716 Bytes

Versions: 1

Compression:

Stored size: 716 Bytes

Contents

module Trade
  class Admin::CashesController < Admin::BaseController
    before_action :set_cash, only: [:show, :edit, :update, :destroy]

    def index
      @cashes = Cash.order(id: :desc).page(params[:page])
    end

    def show
    end

    def edit
    end

    def update
      @cash.assign_attributes(cash_params)

      unless @cash.save
        render :edit, locals: { model: @cash }, status: :unprocessable_entity
      end
    end

    def destroy
      @cash.destroy
    end

    private
    def set_cash
      @cash = Cash.find(params[:id])
    end

    def cash_params
      params.fetch(:cash, {}).permit(
        :account_bank,
        :account_name,
        :account_num
      )
    end

  end
end

Version data entries

1 entries across 1 versions & 1 rubygems

Version Path
rails_trade-0.0.3 app/controllers/trade/admin/cashes_controller.rb