foodsoft/app/controllers/admin/bank_gateways_controller.rb

42 lines
1.1 KiB
Ruby
Raw Permalink Normal View History

2021-03-05 12:44:53 +01:00
class Admin::BankGatewaysController < Admin::BaseController
inherit_resources
def new
@bank_gateway = BankGateway.new(params[:bank_gateway])
render layout: false
end
def edit
@bank_gateway = BankGateway.find(params[:id])
render action: 'new', layout: false
end
2021-03-05 12:44:53 +01:00
def create
@bank_gateway = BankGateway.new(params[:bank_gateway])
if @bank_gateway.valid? && @bank_gateway.save
redirect_to update_bank_gateways_admin_finances_url, status: :see_other
else
render action: 'new', layout: false
end
end
def update
@bank_gateway = BankGateway.find(params[:id])
if @bank_gateway.update(params[:bank_gateway])
redirect_to update_bank_gateways_admin_finances_url, status: :see_other
else
render action: 'new', layout: false
end
end
def destroy
@bank_gateway = BankGateway.find(params[:id])
@bank_gateway.destroy
redirect_to update_bank_gateways_admin_finances_url, status: :see_other
rescue StandardError => e
flash.now[:alert] = e.message
render template: 'shared/alert'
end
end