lib/braintree_rails/customer.rb in braintree-rails-0.1.0 vs lib/braintree_rails/customer.rb in braintree-rails-0.2.0
- old
+ new
@@ -9,11 +9,11 @@
attr_reader :addresses, :credit_cards
def initialize(customer = {})
customer = ensure_customer(customer)
assign_attributes(extract_values(customer))
- @addresses = Addresses.new(self, customer.addresses)
- @credit_cards = CreditCards.new(self, customer.credit_cards)
+ @addresses = Addresses.new(self, customer.try(:addresses))
+ @credit_cards = CreditCards.new(self, customer.try(:credit_cards))
super
end
def full_name
"#{first_name} #{last_name}".strip
\ No newline at end of file