feat(bank_accounts): add strong params
This commit is contained in:
parent
50de35911d
commit
32d2039c19
2 changed files with 12 additions and 9 deletions
|
@ -61,5 +61,11 @@ module Nonprofits
|
|||
NonprofitMailer.delay.new_bank_account_notification(ba) if ba.valid?
|
||||
respond_to { |format| format.json { render json: {} } }
|
||||
end
|
||||
|
||||
private
|
||||
|
||||
def required_params
|
||||
params.permit(:name, :confirmation_token, :account_number, :bank_name, :pending_verification, :status, :email, :deleted, :stripe_bank_account_token, :stripe_bank_account_id, :nonprofit_id)
|
||||
end
|
||||
end
|
||||
end
|
||||
|
|
|
@ -2,8 +2,6 @@
|
|||
|
||||
# License: AGPL-3.0-or-later WITH Web-Template-Output-Additional-Permission-3.0-or-later
|
||||
class BankAccount < ApplicationRecord
|
||||
# TODO
|
||||
# attr_accessible \
|
||||
# :name, # str (readable bank name identifier, eg. "Wells Fargo *1234")
|
||||
# :confirmation_token, # str (randomly generated private token for email confirmation)
|
||||
# :account_number, # str (last digits only)
|
||||
|
@ -15,13 +13,12 @@ class BankAccount < ApplicationRecord
|
|||
# :stripe_bank_account_token, # str
|
||||
# :stripe_bank_account_id, # str
|
||||
# :nonprofit_id, :nonprofit
|
||||
|
||||
# validates :stripe_bank_account_token, presence: true, uniqueness: true
|
||||
# validates :stripe_bank_account_id, presence: true, uniqueness: true
|
||||
# validates :nonprofit, presence: true
|
||||
# validates :email, presence: true, format: {with: Email::Regex}
|
||||
# validate :nonprofit_must_be_vetted, on: :create
|
||||
# validate :nonprofit_has_stripe_account
|
||||
validates :stripe_bank_account_token, presence: true, uniqueness: true
|
||||
validates :stripe_bank_account_id, presence: true, uniqueness: true
|
||||
validates :nonprofit, presence: true
|
||||
validates :email, presence: true, format: {with: Email::Regex}
|
||||
validate :nonprofit_must_be_vetted, on: :create
|
||||
validate :nonprofit_has_stripe_account
|
||||
|
||||
has_many :payouts
|
||||
belongs_to :nonprofit
|
||||
|
|
Loading…
Reference in a new issue