app/models/sale.rb
# Valor total en todos los pagos
Valor total en todos los pagos
Valor total en todos los pagos
def paid_total
    paid_total = 0
    unless self.payments.blank?
      for payment in self.payments
        paid_total += payment.amount.blank? ? 0 : payment.amount
      end
    end
    return paid_total
  end
def paid_total paid_total = 0 unless self . payments . blank? for payment in self . payments paid_total += payment . amount . blank? ? 0 : payment . amount end end return paid_total end
Valor total en todos los pagos
Valor total en todos los pagos