Sha256: 110ff8e633aabf0b0dd60fc3c5b5c70abca96dad57087653a1c744712738b074
Contents?: true
Size: 664 Bytes
Versions: 15
Compression:
Stored size: 664 Bytes
Contents
module Comee module Core class CustomerOrderItem < ApplicationRecord before_save :calculate_total_price, unless: proc { |item| item.total_price } belongs_to :customer_order belongs_to :product belongs_to :unit validates :customer_item_no, :quantity, :price, :delivery_date, presence: true def calculate_total_price self.total_price = price * quantity end def self.ransackable_attributes(_auth_object = nil) %w[id customer_order_id product_id unit_id] end def self.ransackable_associations(_auth_object = nil) %w[customer_order product unit] end end end end
Version data entries
15 entries across 15 versions & 1 rubygems