Class: Admin::BankGatewaysController

Inherits:
BaseController
  • Object
show all
Defined in:
app/controllers/admin/bank_gateways_controller.rb

Instance Method Summary collapse

Instance Method Details

#createObject



14
15
16
17
18
19
20
21
# File 'app/controllers/admin/bank_gateways_controller.rb', line 14

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

#destroyObject



33
34
35
36
37
38
39
40
# File 'app/controllers/admin/bank_gateways_controller.rb', line 33

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

#editObject



9
10
11
12
# File 'app/controllers/admin/bank_gateways_controller.rb', line 9

def edit
  @bank_gateway = BankGateway.find(params[:id])
  render action: 'new', layout: false
end

#newObject



4
5
6
7
# File 'app/controllers/admin/bank_gateways_controller.rb', line 4

def new
  @bank_gateway = BankGateway.new(params[:bank_gateway])
  render layout: false
end

#updateObject



23
24
25
26
27
28
29
30
31
# File 'app/controllers/admin/bank_gateways_controller.rb', line 23

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