Sha256: 2d5f294f5440b6b3be173605a1f25b8de74539b2836c2c69aef8816cb5b4f18c
Contents?: true
Size: 558 Bytes
Versions: 10
Compression:
Stored size: 558 Bytes
Contents
module Comee module Core class SalesOrderItem < ApplicationRecord before_validation :set_delivery_date, if: proc { delivery_date.nil? } belongs_to :sales_order belongs_to :product validates :delivery_date, presence: true validates :quantity, :price, presence: true, numericality: {greater_than: 0} delegate(:name, to: :product, prefix: true) delegate(:code, to: :product, prefix: true) def set_delivery_date self.delivery_date = sales_order.expected_delivery_date end end end end
Version data entries
10 entries across 10 versions & 1 rubygems