Sha256: 951570c4189915999a9ea67365b722f7fd0492e8a5fcd179b64864ce0520239b
Contents?: true
Size: 580 Bytes
Versions: 23
Compression:
Stored size: 580 Bytes
Contents
module Comee module Core class CreditNoteItem < ApplicationRecord before_save { self.total_price = unit_price * quantity } after_save :update_credit_note after_destroy :update_credit_note belongs_to :credit_note belongs_to :invoice_item validates :quantity, :unit_price, presence: true, numericality: {greater_than: 0} validates :total_price, numericality: {greater_than_or_equal_to: 0, allow_nil: true} def update_credit_note credit_note.calculate_total_price credit_note.save! end end end end
Version data entries
23 entries across 23 versions & 1 rubygems