Create estimate on issue close.

This commit is contained in:
2026-03-06 21:42:27 -05:00
parent b297657763
commit 47a7447688
4 changed files with 116 additions and 0 deletions

View File

@@ -14,4 +14,17 @@ class LineItem < ApplicationRecord
validates :description, presence: true
validates :quantity, numericality: { greater_than: 0 }
validates :unit_price, numericality: { greater_than_or_equal_to: 0 }
before_save :total
private
def total
log "Updating line total"
self.line_total = self.unit_price * self.quantity
end
def log(msg)
Rails.logger.info "[LineItem] #{msg}"
end
end