From 5d4c49c85d83050abe0aece01246bc19e2b29b74 Mon Sep 17 00:00:00 2001 From: Rick Barrette Date: Fri, 5 Aug 2016 21:23:07 -0400 Subject: [PATCH] Update payment.rb --- app/models/payment.rb | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) diff --git a/app/models/payment.rb b/app/models/payment.rb index 9cfcf70..bdf6641 100644 --- a/app/models/payment.rb +++ b/app/models/payment.rb @@ -16,6 +16,13 @@ class Payment attr_accessor :errors, :customer_id, :account_id, :payment_method_id, :total_amount validates_presence_of :customer_id, :account_id, :payment_method_id, :total_amount validates :total_amount, numericality: true + + #Required dependency for ActiveModel::Errors + extend ActiveModel::Naming + + def initialize + @errors = ActiveModel::Errors.new(self) + end def save payment = Quickbooks::Model::Payment.new @@ -31,7 +38,7 @@ class Payment begin Qbo.get_base(:payment).service.update(payment) rescue Exception => e - errors.add(e.message) + @errors.add(e.message) end end