# -*- encoding : utf-8 -*- class Admin::PBankAccountsController < ApplicationController layout "admin" before_action :auth_admin before_action :admin_space def admin_space @admin_space = "payments" end def index @p_bank_accounts = PBankAccount.order(:iban).all end def show @p_bank_account = PBankAccount.find(params[:id]) end def new @p_bank_account = PBankAccount.new(:owner => true) end def edit @p_bank_account = PBankAccount.find(params[:id]) end def create @p_bank_account = PBankAccount.new(params.require(:p_bank_account).permit!) if @p_bank_account.save @p_bank_accounts = PBankAccount.order(:iban).all else render action: "new" end end def update @p_bank_account = PBankAccount.find(params[:id]) if @p_bank_account.update_attributes(params.require(:p_bank_account).permit!) @p_bank_accounts = PBankAccount.order(:iban).all else render action: "edit" end end def destroy @p_bank_account = PBankAccount.find(params[:id]) @p_bank_account.destroy end end