Sha256: 26e3eec53a381b4d6aa11b5ee034bf7f47887431e9b8c78658a03b899b946c04
Contents?: true
Size: 508 Bytes
Versions: 45
Compression:
Stored size: 508 Bytes
Contents
module Comee module Core class AdditionalItem < ApplicationRecord before_save { self.total_price = unit_price * quantity } after_save :update_invoice after_destroy :update_invoice belongs_to :invoice validates :description, presence: true validates :quantity, :unit_price, presence: true, numericality: {greater_than: 0} def update_invoice invoice.calculate_total_price invoice.calculate_vat invoice.save! end end end end
Version data entries
45 entries across 45 versions & 1 rubygems