# -*- encoding : utf-8 -*- class Admin::PBanksController < ApplicationController layout "admin" before_action :auth_admin before_action :admin_space def admin_space @admin_space = "payments" end def index @p_banks = PBank.order(:name).all end def show @p_bank = PBank.find(params[:id]) end def new @p_bank = PBank.new end def edit @p_bank = PBank.find(params[:id]) end def create @p_bank = PBank.new(params.require(:p_bank).permit!) if @p_bank.save @p_banks = PBank.order(:name).all else render action: "new" end end def update @p_bank = PBank.find(params[:id]) if @p_bank.update_attributes(params.require(:p_bank).permit!) @p_banks = PBank.order(:name).all else render action: "edit" end end def destroy @p_bank = PBank.find(params[:id]) @p_bank.destroy end end