feat(payments): add strong params
This commit is contained in:
parent
41d578815a
commit
8f1b33cabd
2 changed files with 9 additions and 2 deletions
|
@ -45,7 +45,7 @@ module Nonprofits
|
||||||
|
|
||||||
def update
|
def update
|
||||||
@payment = current_nonprofit.payments.find(params[:id])
|
@payment = current_nonprofit.payments.find(params[:id])
|
||||||
@payment.update_attributes(params[:payment])
|
@payment.update_attributes(payment_params)
|
||||||
json_saved @payment
|
json_saved @payment
|
||||||
end
|
end
|
||||||
|
|
||||||
|
@ -76,5 +76,11 @@ module Nonprofits
|
||||||
PaymentMailer.resend_admin_receipt(params[:id], current_user.id)
|
PaymentMailer.resend_admin_receipt(params[:id], current_user.id)
|
||||||
render json: {}
|
render json: {}
|
||||||
end
|
end
|
||||||
|
|
||||||
|
private
|
||||||
|
|
||||||
|
def payment_params
|
||||||
|
params.require(:payment).permit(:towards, :gross_amount, :refund_total, :fee_total, :kind, :date)
|
||||||
|
end
|
||||||
end # class PaymentsController
|
end # class PaymentsController
|
||||||
end # module Nonprofits
|
end # module Nonprofits
|
||||||
|
|
|
@ -2,7 +2,8 @@
|
||||||
|
|
||||||
# License: AGPL-3.0-or-later WITH Web-Template-Output-Additional-Permission-3.0-or-later
|
# License: AGPL-3.0-or-later WITH Web-Template-Output-Additional-Permission-3.0-or-later
|
||||||
class PaymentImport < ApplicationRecord
|
class PaymentImport < ApplicationRecord
|
||||||
# attr_accessible :nonprofit, :user
|
# :nonprofit,
|
||||||
|
# :user
|
||||||
has_and_belongs_to_many :donations
|
has_and_belongs_to_many :donations
|
||||||
belongs_to :nonprofit
|
belongs_to :nonprofit
|
||||||
belongs_to :user
|
belongs_to :user
|
||||||
|
|
Loading…
Reference in a new issue