Class: Trade::Admin::PaymentMethodsController
- Inherits:
-
BaseController
- Object
- BaseController
- Trade::Admin::PaymentMethodsController
- Defined in:
- app/controllers/trade/admin/payment_methods_controller.rb
Instance Method Summary collapse
- #create ⇒ Object
- #destroy ⇒ Object
- #edit ⇒ Object
- #edit_references ⇒ Object
- #index ⇒ Object
- #merge_from ⇒ Object
- #mine ⇒ Object
- #new ⇒ Object
- #show ⇒ Object
- #unverified ⇒ Object
- #update ⇒ Object
- #update_references ⇒ Object
- #verify ⇒ Object
Instance Method Details
#create ⇒ Object
28 29 30 31 32 33 34 35 36 37 38 39 40 |
# File 'app/controllers/trade/admin/payment_methods_controller.rb', line 28 def create @payment_method = PaymentMethod.new(payment_method_params.merge(verified: true, creator_id: the_audit_user.id)) respond_to do |format| if @payment_method.save format.html { redirect_to admin_payment_methods_url } format.js else format.html { render :new } format.js end end end |
#destroy ⇒ Object
80 81 82 83 |
# File 'app/controllers/trade/admin/payment_methods_controller.rb', line 80 def destroy @payment_method.destroy redirect_to admin_payment_methods_url end |
#edit ⇒ Object
45 46 47 48 49 50 |
# File 'app/controllers/trade/admin/payment_methods_controller.rb', line 45 def edit respond_to do |format| format.html format.js end end |
#edit_references ⇒ Object
72 73 74 |
# File 'app/controllers/trade/admin/payment_methods_controller.rb', line 72 def edit_references end |
#index ⇒ Object
4 5 6 |
# File 'app/controllers/trade/admin/payment_methods_controller.rb', line 4 def index @payment_methods = PaymentMethod.includes(:payment_references).default_where(query_params).page(params[:page]) end |
#merge_from ⇒ Object
66 67 68 69 70 |
# File 'app/controllers/trade/admin/payment_methods_controller.rb', line 66 def merge_from @payment_method.merge_from(params[:other_id]) redirect_back fallback_location: unverified_admin_payment_methods_url end |
#mine ⇒ Object
12 13 14 15 16 17 |
# File 'app/controllers/trade/admin/payment_methods_controller.rb', line 12 def mine default_params = { creator_id: the_audit_user.id } @payment_methods = PaymentMethod.includes(:payment_references).default_where(default_params).page(params[:page]) end |
#new ⇒ Object
19 20 21 22 23 24 25 26 |
# File 'app/controllers/trade/admin/payment_methods_controller.rb', line 19 def new @payment_method = PaymentMethod.new respond_to do |format| format.html format.js end end |
#show ⇒ Object
42 43 |
# File 'app/controllers/trade/admin/payment_methods_controller.rb', line 42 def show end |
#unverified ⇒ Object
8 9 10 |
# File 'app/controllers/trade/admin/payment_methods_controller.rb', line 8 def unverified @payment_methods = PaymentMethod.includes(:payment_references).unscoped.where(verified: [false, nil]).default_where(query_params).page(params[:page]).references(:payment_references) end |
#update ⇒ Object
52 53 54 55 56 57 58 |
# File 'app/controllers/trade/admin/payment_methods_controller.rb', line 52 def update if @payment_method.update(payment_method_params) redirect_to admin_payment_methods_url else render :edit end end |
#update_references ⇒ Object
76 77 78 |
# File 'app/controllers/trade/admin/payment_methods_controller.rb', line 76 def update_references end |
#verify ⇒ Object
60 61 62 63 64 |
# File 'app/controllers/trade/admin/payment_methods_controller.rb', line 60 def verify @payment_method.update(verified: true) redirect_back fallback_location: unverified_admin_payment_methods_url end |