diff --git a/app/controllers/pay_controller.rb b/app/controllers/pay_controller.rb index b7ca2d5..30368f1 100644 --- a/app/controllers/pay_controller.rb +++ b/app/controllers/pay_controller.rb @@ -13,7 +13,7 @@ class PayController < ApplicationController pay.user_id = current_user.user_id msg = true if pay.save! respond_to do |format| - format.json {render :json => {:msg => :world} } + format.json {render :json => {:msg => msg } } end end @@ -23,4 +23,14 @@ class PayController < ApplicationController end end + def destroy + pay = Pay.find_by_id(params[:id]) + if pay.present? and pay.destroy + flash[:success] = "Successfully Deleted Entry" + else + flash[:error] = "Unable to process that request at this time" + end + redirect_to user_pay_index_path + end + end diff --git a/app/models/pay.rb b/app/models/pay.rb index a1ee601..74116a3 100644 --- a/app/models/pay.rb +++ b/app/models/pay.rb @@ -15,7 +15,7 @@ class Pay < ActiveRecord::Base before_save :encrypt_bank_account_num def as_json - super(only: [:bank_account_num, :bank_routing_num, :percent_of_deposit]) + super(only: [:bank_account_num, :bank_routing_num, :percent_of_deposit, :id]) end def encrypt_bank_account_num diff --git a/app/views/pay/index.html.erb b/app/views/pay/index.html.erb index c9bb2e9..74c6a8a 100644 --- a/app/views/pay/index.html.erb +++ b/app/views/pay/index.html.erb @@ -97,23 +97,7 @@ - +
@@ -132,6 +116,13 @@