Class: Trade::My::PaymentMethodsController

Inherits:
BaseController
  • Object
show all
Defined in:
app/controllers/trade/my/payment_methods_controller.rb

Instance Method Summary collapse

Instance Method Details

#createObject



19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
# File 'app/controllers/trade/my/payment_methods_controller.rb', line 19

def create
  @payment_method = current_buyer.payment_methods.build(payment_method_params)

  respond_to do |format|
    if @payment_method.detective_save
      format.html
      format.json { render json: @payment_method.as_json(methods: 'kind') }
      format.js
    else
      format.html { render :new }
      format.json
      format.js
    end
  end
end

#destroyObject



50
51
52
53
54
55
56
57
# File 'app/controllers/trade/my/payment_methods_controller.rb', line 50

def destroy
  @payment_method.destroy

  respond_to do |format|
    format.html { head :no_cont }
    format.js
  end
end

#editObject



38
39
# File 'app/controllers/trade/my/payment_methods_controller.rb', line 38

def edit
end

#indexObject



4
5
6
7
8
9
10
11
12
13
# File 'app/controllers/trade/my/payment_methods_controller.rb', line 4

def index
  @payment_methods = current_buyer.payment_methods

  respond_to do |format|
    format.html {

    }
    format.json { render json: @payment_methods.as_json(methods: 'kind') }
  end
end

#newObject



15
16
17
# File 'app/controllers/trade/my/payment_methods_controller.rb', line 15

def new
  @payment_method = current_buyer.payment_methods.build
end

#showObject



35
36
# File 'app/controllers/trade/my/payment_methods_controller.rb', line 35

def show
end

#updateObject



41
42
43
44
45
46
47
48
# File 'app/controllers/trade/my/payment_methods_controller.rb', line 41

def update
  @payment_method.assign_attributes(payment_method_params)
  if @payment_method.detective_save
    render 'update'
  else
    render :edit
  end
end