foodsoft/app/controllers/admin/bank_accounts_controller.rb
viehlieb af3444bba6
Some checks failed
continuous-integration/drone/push Build is failing
replace update_attributes with updat since deprecated
2022-10-13 18:25:52 +02:00

41 lines
1.1 KiB
Ruby

class Admin::BankAccountsController < Admin::BaseController
inherit_resources
def new
@bank_account = BankAccount.new(params[:bank_account])
render :layout => false
end
def create
@bank_account = BankAccount.new(params[:bank_account])
if @bank_account.valid? && @bank_account.save
redirect_to update_bank_accounts_admin_finances_url, :status => 303
else
render :action => 'new', :layout => false
end
end
def edit
@bank_account = BankAccount.find(params[:id])
render :action => 'new', :layout => false
end
def update
@bank_account = BankAccount.find(params[:id])
if @bank_account.update(params[:bank_account])
redirect_to update_bank_accounts_admin_finances_url, :status => 303
else
render :action => 'new', :layout => false
end
end
def destroy
@bank_account = BankAccount.find(params[:id])
@bank_account.destroy
redirect_to update_bank_accounts_admin_finances_url, :status => 303
rescue => error
flash.now[:alert] = error.message
render template: 'shared/alert'
end
end