Class: BraintreeRails::MerchantAccount
- Inherits:
-
Object
- Object
- BraintreeRails::MerchantAccount
- Includes:
- Model
- Defined in:
- lib/braintree_rails/merchant_account.rb
Instance Method Summary collapse
- #add_errors(validation_errors) ⇒ Object
- #attributes_for(action) ⇒ Object
- #business_attributes ⇒ Object
- #funding_attributes ⇒ Object
- #individual_attributes ⇒ Object
- #propagate_errors_to_associations(validation_errors) ⇒ Object
Methods included from Model
Instance Method Details
#add_errors(validation_errors) ⇒ Object
22 23 24 25 |
# File 'lib/braintree_rails/merchant_account.rb', line 22 def add_errors(validation_errors) propagate_errors_to_associations(extract_errors(validation_errors)) super(validation_errors) end |
#attributes_for(action) ⇒ Object
33 34 35 |
# File 'lib/braintree_rails/merchant_account.rb', line 33 def attributes_for(action) super.merge(individual_attributes).merge(business_attributes).merge(funding_attributes) end |
#business_attributes ⇒ Object
41 42 43 |
# File 'lib/braintree_rails/merchant_account.rb', line 41 def business_attributes business.present? ? {:business => business.attributes_for(:as_association)} : {} end |
#funding_attributes ⇒ Object
45 46 47 |
# File 'lib/braintree_rails/merchant_account.rb', line 45 def funding_attributes funding.present? ? {:funding => funding.attributes_for(:as_association)} : {} end |
#individual_attributes ⇒ Object
37 38 39 |
# File 'lib/braintree_rails/merchant_account.rb', line 37 def individual_attributes individual.present? ? {:individual => individual.attributes_for(:as_association)} : {} end |
#propagate_errors_to_associations(validation_errors) ⇒ Object
27 28 29 30 31 |
# File 'lib/braintree_rails/merchant_account.rb', line 27 def propagate_errors_to_associations(validation_errors) [individual, business, funding].each do |association| association.add_errors(validation_errors) if association && errors end end |