module Comee module Core class AdditionalItem < ApplicationRecord before_save { self.total_price = unit_price * quantity } belongs_to :invoice validates :quantity, :unit_price, presence: true, numericality: {greater_than: 0} end end end