Update payment.rb

This commit is contained in:
2016-08-05 21:23:07 -04:00
committed by GitHub
parent 5bc9ca34a4
commit 5d4c49c85d

View File

@@ -17,6 +17,13 @@ class Payment
validates_presence_of :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 validates :total_amount, numericality: true
#Required dependency for ActiveModel::Errors
extend ActiveModel::Naming
def initialize
@errors = ActiveModel::Errors.new(self)
end
def save def save
payment = Quickbooks::Model::Payment.new payment = Quickbooks::Model::Payment.new
@@ -31,7 +38,7 @@ class Payment
begin begin
Qbo.get_base(:payment).service.update(payment) Qbo.get_base(:payment).service.update(payment)
rescue Exception => e rescue Exception => e
errors.add(e.message) @errors.add(e.message)
end end
end end