Class: Admin::PaymentMethodsController

Inherits:
AdminController
  • Object
show all
Defined in:
app/controllers/admin/payment_methods_controller.rb

Instance Method Summary collapse

Instance Method Details

#disableObject



26
27
28
29
30
31
# File 'app/controllers/admin/payment_methods_controller.rb', line 26

def disable
  @payment_method.update_attributes! enabled: false
  respond_to do |format|
    format.html { redirect_to  action: :index, notic: "Payment method #{@payment_method.name} has been disabled" }
  end
end

#enableObject



19
20
21
22
23
24
# File 'app/controllers/admin/payment_methods_controller.rb', line 19

def enable
  @payment_method.update_attributes! enabled: true
  respond_to do |format|
    format.html { redirect_to  action: :index, notice: "Payment method #{@payment_method.name} has been enabled" }
  end
end

#indexObject



6
7
8
9
10
11
12
13
14
15
16
17
# File 'app/controllers/admin/payment_methods_controller.rb', line 6

def index
  @disabled_payment_methods = PaymentMethod.disabled.ascending

  respond_to do |format|
    format.html do

      if PaymentMethod.count == 0
        flash.now[:error] = 'You have not setup any payment method. User wil not be able to make payment'
      end
    end
  end
end